Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRecordsNotFound = errors.New("no rows in result set")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Get(ctx context.Context, dest interface{}, sql string, args ...interface{}) error Select(ctx context.Context, dest interface{}, sql string, args ...interface{}) error Exec(ctx context.Context, sql string, args ...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 InTx(ctx context.Context, isoLevel pgx.TxIsoLevel, f func(ctx context.Context) error) error Ping(ctx context.Context) error Close() }
type Config ¶
type Config struct { Host string `json:"host" mapstructure:"host"` Port string `json:"port" mapstructure:"port"` Name string `json:"name" mapstructure:"name"` User string `json:"user" mapstructure:"user"` Password string `json:"password" mapstructure:"password"` SSLMode string `json:"sslMode" mapstructure:"sslMode"` // Query timeout, default is 5s QueryTimeout time.Duration `json:"queryTimeout" mapstructure:"queryTimeout"` // Minimum number of idle connections (inactive connections that remain open) PoolMinConnections string `json:"poolMinConnections" mapstructure:"poolMinConnections"` // Maximum number of connections PoolMaxConnections string `json:"poolMaxConnections" mapstructure:"poolMaxConnections"` // The duration for which a connection will live before being closed PoolMaxConnLife time.Duration `json:"poolMaxConnLife" mapstructure:"poolMaxConnLife"` // Time after which an idle connection will be closed PoolMaxConnIdle time.Duration `json:"poolMaxConnIdle" mapstructure:"poolMaxConnIdle"` // Checks each connection taken from the pool to ensure it's alive // Otherwise, pgx will drop it and provide a new one // Disabling this check speeds up queries, // but if a bad connection is encountered, the query will fail with an error EnableBeforeAcquirePing bool `json:"enableBeforeAcquirePing" mapstructure:"enableBeforeAcquirePing"` // Allows the scanner to ignore database columns that do not exist in the destination AllowUnknownColumns bool `json:"allowUnknownColumns" mapstructure:"allowUnknownColumns"` }
Click to show internal directories.
Click to hide internal directories.