Documentation
¶
Index ¶
- func ExtractTxQueryKey(ctx context.Context) (string, bool)
- func InjectTX(ctx context.Context, tx Tx) context.Context
- func NewClient(ctx context.Context, log *slog.Logger, cfg *Config) (pool *pgxpool.Pool, err error)
- type Config
- func (c *Config) WithAcquireTimeout(d time.Duration) *Config
- func (c *Config) WithConnAmount(amount int32) *Config
- func (c *Config) WithHealthCheckPeriod(d time.Duration) *Config
- func (c *Config) WithMaxConnAttempts(attempts int) *Config
- func (c *Config) WithMaxConnIdleTime(d time.Duration) *Config
- func (c *Config) WithMaxConnLifetime(d time.Duration) *Config
- func (c *Config) WithMinConnAmount(amount int32) *Config
- func (c *Config) WithRetryConnDelay(delay time.Duration) *Config
- func (c *Config) WithTracer(tracer pgx.QueryTracer) *Config
- type Handler
- type Migrator
- type Postgres
- type Tx
- type TxManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Username string
Password string
Host string
Port string
Database string
ConnAmount *int32
MinConnAmount *int32
MaxConnIdleTime *time.Duration
MaxConnLifetime *time.Duration
HealthCheckPeriod *time.Duration
AcquireTimeout time.Duration
// contains filtered or unexported fields
}
func (*Config) WithConnAmount ¶
func (*Config) WithHealthCheckPeriod ¶
func (*Config) WithMaxConnAttempts ¶
func (*Config) WithMinConnAmount ¶
func (*Config) WithRetryConnDelay ¶
func (*Config) WithTracer ¶
func (c *Config) WithTracer(tracer pgx.QueryTracer) *Config
type Postgres ¶
type Postgres interface {
Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)
QueryRow(ctx context.Context, query string, args ...interface{}) pgx.Row
Exec(ctx context.Context, query string, args ...interface{}) (commandTag pgconn.CommandTag, err error)
BeginTx(ctx context.Context, txOptions pgx.TxOptions) (Tx, error)
Pool() *pgxpool.Pool
Close()
}
type Tx ¶
type Tx interface {
Begin(ctx context.Context) (pgx.Tx, error)
Commit(ctx context.Context) error
Rollback(ctx context.Context) error
CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
LargeObjects() pgx.LargeObjects
Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)
Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error)
Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
Conn() *pgx.Conn
}
Click to show internal directories.
Click to hide internal directories.