forked from chrisyxlee/pgxpoolmock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pgx.go
31 lines (27 loc) · 1.19 KB
/
pgx.go
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
30
31
package pgxpoolmock
import (
"context"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
)
// Implements pgxpool.PgxPool and pgx.Tx.
type PgxIface interface {
// pgx.Tx
Commit(ctx context.Context) error
Rollback(ctx context.Context) error
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnName []string, rowSvc pgx.CopyFromSource) (int64, error)
LargeObjects() pgx.LargeObjects
Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
Conn() *pgx.Conn
// pgx.PgxPool
Close()
Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
// QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func() error) (pgconn.CommandTag, error)
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Begin(ctx context.Context) (pgx.Tx, error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
// BeginFunc(ctx context.Context, f func(pgx.Tx) error) error
// BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, f func(pgx.Tx) error) error
}