Skip to content

Simple adapter interface and implementations for different PostgreSQL drivers for Go

License

Notifications You must be signed in to change notification settings

vgarvardt/go-pg-adapter

Repository files navigation

go-pg-adapter

GoDoc Coverage Status ReportCard License

Simple adapter interface and implementations for different PostgreSQL drivers for Go.

package pgadapter

import (
  "context"
  "errors"
)

var (
  // ErrNoRows is the driver-agnostic error returned when no record is found
  ErrNoRows = errors.New("sql: no rows in result set")
  // ErrManyRows is the driver-agnostic error returned when more than one record is found
  // while only one was expected
  ErrManyRows = errors.New("sql: more than one row in result set")
)

// Adapter represents DB access layer interface for different PostgreSQL drivers
type Adapter interface {
  Exec(ctx context.Context, query string, args ...interface{}) error
  SelectOne(ctx context.Context, dst interface{}, query string, args ...interface{}) error
}

Install

go get -u -v github.com/vgarvardt/go-pg-adapter

PostgreSQL drivers

The package bundles the following adapter implementations:

MIT License

Copyright (c) 2020 Vladimir Garvardt

About

Simple adapter interface and implementations for different PostgreSQL drivers for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages