Skip to content

Commit

Permalink
Rename QueryI to Querier.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgysavva committed Jun 28, 2020
1 parent fbd6b8c commit ff28999
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions pgxscan/pgxscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import (
"github.com/georgysavva/dbscan"
)

// QueryI is something that pgxscan can query and get the pgx.Rows from.
// Querier is something that pgxscan can query and get the pgx.Rows from.
// For example, it can be: *pgxpool.Pool, *pgx.Conn or pgx.Tx.
type QueryI interface {
type Querier interface {
Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
}

var (
_ QueryI = &pgxpool.Pool{}
_ QueryI = &pgx.Conn{}
_ QueryI = *new(pgx.Tx)
_ Querier = &pgxpool.Pool{}
_ Querier = &pgx.Conn{}
_ Querier = *new(pgx.Tx)
)

// QueryAll is a high-level function that queries the rows and calls the ScanAll function.
// See ScanAll for details.
func QueryAll(ctx context.Context, dst interface{}, q QueryI, query string, args ...interface{}) error {
func QueryAll(ctx context.Context, dst interface{}, q Querier, query string, args ...interface{}) error {
rows, err := q.Query(ctx, query, args...)
if err != nil {
return errors.Wrap(err, "pgxscan: query result rows")
Expand All @@ -35,7 +35,7 @@ func QueryAll(ctx context.Context, dst interface{}, q QueryI, query string, args

// QueryOne is a high-level function that queries the rows and calls the ScanOne function.
// See ScanOne for details.
func QueryOne(ctx context.Context, dst interface{}, q QueryI, query string, args ...interface{}) error {
func QueryOne(ctx context.Context, dst interface{}, q Querier, query string, args ...interface{}) error {
rows, err := q.Query(ctx, query, args...)
if err != nil {
return errors.Wrap(err, "pgxscan: query result rows")
Expand Down
14 changes: 7 additions & 7 deletions sqlscan/sqlscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ import (
"github.com/georgysavva/dbscan"
)

// QueryI is something that sqlscan can query and get the *sql.Rows from.
// Querier is something that sqlscan can query and get the *sql.Rows from.
// For example, it can be: *sql.DB, *sql.Conn or *sql.Tx.
type QueryI interface {
type Querier interface {
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

var (
_ QueryI = &sql.DB{}
_ QueryI = &sql.Conn{}
_ QueryI = &sql.Tx{}
_ Querier = &sql.DB{}
_ Querier = &sql.Conn{}
_ Querier = &sql.Tx{}
)

// QueryAll is a high-level function that queries the rows and calls the ScanAll function.
// See ScanAll for details.
func QueryAll(ctx context.Context, dst interface{}, q QueryI, query string, args ...interface{}) error {
func QueryAll(ctx context.Context, dst interface{}, q Querier, query string, args ...interface{}) error {
rows, err := q.QueryContext(ctx, query, args...)
if err != nil {
return errors.Wrap(err, "sqlscan: query result rows")
Expand All @@ -34,7 +34,7 @@ func QueryAll(ctx context.Context, dst interface{}, q QueryI, query string, args

// QueryOne is a high-level function that queries the rows and calls the ScanOne function.
// See ScanOne for details.
func QueryOne(ctx context.Context, dst interface{}, q QueryI, query string, args ...interface{}) error {
func QueryOne(ctx context.Context, dst interface{}, q Querier, query string, args ...interface{}) error {
rows, err := q.QueryContext(ctx, query, args...)
if err != nil {
return errors.Wrap(err, "sqlscan: query result rows")
Expand Down

0 comments on commit ff28999

Please sign in to comment.