Documentation ¶
Index ¶
- Constants
- func DefaultPoolOpener(ctx context.Context, dsn string) (*pgxpool.Pool, error)
- func Query[T any](ctx context.Context, db *DB, query string, pointers func(*T) []interface{}, ...) ([]T, error)
- type DB
- func (db *DB) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, ...) (int64, error)
- func (db *DB) DoTx(f func(db dbx.DBxer[*pgxpool.Pool, pgx.Tx, pgx.TxOptions]) error, ...) error
- func (db *DB) DoTxContext(ctx context.Context, ...) error
- func (db *DB) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
- func (db *DB) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
- func (db *DB) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
- func (db *DB) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
- func (db *DB) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
- func (db *DB) Tx() (pgx.Tx, error)
- func (db *DB) WithCtx(ctx context.Context) *DB
- func (db *DB) WithDefaultNodeStrategy(strategy dbx.GetNodeStragegy) *DB
- func (db *DB) WithNodeWaitTimeout(timeout time.Duration) *DB
- func (db *DB) WithReadFromNodeStrategy(strategy dbx.GetNodeStragegy) *DB
- func (db *DB) WithWriteToNodeStrategy(strategy dbx.GetNodeStragegy) *DB
- type Option
- type PoolOpener
Constants ¶
View Source
const DefaultPingTimeout = 15 * time.Second
Variables ¶
This section is empty.
Functions ¶
func DefaultPoolOpener ¶
Types ¶
type DB ¶
func (*DB) DoTxContext ¶
func (*DB) WithDefaultNodeStrategy ¶ added in v0.0.3
func (db *DB) WithDefaultNodeStrategy(strategy dbx.GetNodeStragegy) *DB
func (*DB) WithNodeWaitTimeout ¶ added in v0.0.3
func (*DB) WithReadFromNodeStrategy ¶ added in v0.0.3
func (db *DB) WithReadFromNodeStrategy(strategy dbx.GetNodeStragegy) *DB
func (*DB) WithWriteToNodeStrategy ¶ added in v0.0.3
func (db *DB) WithWriteToNodeStrategy(strategy dbx.GetNodeStragegy) *DB
type Option ¶
type Option func(*DB)
func WithNodeChecker ¶ added in v0.0.7
func WithNodeChecker(nodeChecker cluster.NodeChecker[*pgxpool.Pool]) Option
func WithPoolCloser ¶ added in v0.0.7
func WithPoolCloser(poolCloser cluster.ConnCloser[*pgxpool.Pool]) Option
func WithPoolOpener ¶
func WithPoolOpener(poolOpener PoolOpener) Option
Click to show internal directories.
Click to hide internal directories.