-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathpgx_pool.go
More file actions
27 lines (24 loc) · 960 Bytes
/
pgx_pool.go
File metadata and controls
27 lines (24 loc) · 960 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
package pgxpoolmock
import (
"context"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
)
type PgxPool interface {
Acquire(ctx context.Context) (*pgxpool.Conn, error)
AcquireAllIdle(ctx context.Context) []*pgxpool.Conn
AcquireFunc(ctx context.Context, f func(*pgxpool.Conn) error) error
Begin(ctx context.Context) (pgx.Tx, error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
Close()
Config() *pgxpool.Config
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
Ping(ctx context.Context) error
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
Reset()
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
Stat() *pgxpool.Stat
}