Skip to content

Commit cb37871

Browse files
committed
Use adapter package instead of bundling adapters
1 parent 7055b72 commit cb37871

File tree

11 files changed

+314
-559
lines changed

11 files changed

+314
-559
lines changed

Gopkg.lock

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
name = "github.com/jmoiron/sqlx"
4646
version = "1.2.0"
4747

48-
[[constraint]]
49-
name = "github.com/vgarvardt/pgx-helpers"
50-
version = "0.1.0"
51-
5248
[[constraint]]
5349
name = "github.com/stretchr/testify"
5450
version = "1.3.0"
51+
52+
[[constraint]]
53+
name = "github.com/vgarvardt/go-pg-adapter"
54+
version = "0.1.1"

client_store.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import (
66
"os"
77

88
"github.com/json-iterator/go"
9+
"github.com/vgarvardt/go-pg-adapter"
910
"gopkg.in/oauth2.v3"
1011
"gopkg.in/oauth2.v3/models"
1112
)
1213

1314
// ClientStore PostgreSQL client store
1415
type ClientStore struct {
15-
adapter Adapter
16+
adapter pgadapter.Adapter
1617
tableName string
1718
logger Logger
1819

@@ -28,7 +29,7 @@ type ClientStoreItem struct {
2829
}
2930

3031
// NewClientStore creates PostgreSQL store instance
31-
func NewClientStore(adapter Adapter, options ...ClientStoreOption) (*ClientStore, error) {
32+
func NewClientStore(adapter pgadapter.Adapter, options ...ClientStoreOption) (*ClientStore, error) {
3233
store := &ClientStore{
3334
adapter: adapter,
3435
tableName: "oauth2_clients",

pg.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
package pg
22

3-
import "errors"
4-
5-
// ErrNoRows is the driver-agnostic error returned when no record is found
6-
var ErrNoRows = errors.New("sql: no rows in result set")
7-
8-
// Adapter represents DB access layer interface for different PostgreSQL drivers
9-
type Adapter interface {
10-
Exec(query string, args ...interface{}) error
11-
SelectOne(dst interface{}, query string, args ...interface{}) error
12-
}
13-
143
// Logger is the PostgreSQL store logger interface
154
type Logger interface {
165
Printf(format string, v ...interface{})

pgx_adapter/adapter.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

pgx_adapter/adapter_test.go

Lines changed: 0 additions & 222 deletions
This file was deleted.

0 commit comments

Comments
 (0)