-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpgxschema.go
More file actions
29 lines (24 loc) · 810 Bytes
/
pgxschema.go
File metadata and controls
29 lines (24 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package pgxschema
import (
"context"
"github.com/jackc/pgconn"
"github.com/jackc/pgx/v4"
)
// Connection defines the interface for either a *pgxpool.Pool or a *pgx.Conn,
// both of which can start new transactions and execute queries.
type Connection interface {
Transactor
Queryer
}
// Queryer defines the interface for either a *pgxpool.Pool, a *pgx.Conn or a
// pgx.Tx, all of which can execute queries
//
type Queryer interface {
Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
}
// Transactor defines the interface for either a *pgxpool.Pool or a *pgx.Conn,
// both of which can start new transactions.
type Transactor interface {
Begin(ctx context.Context) (pgx.Tx, error)
}