Documentation ¶
Overview ¶
Package postgres implements postgres connection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnableToConnect = errors.New("all attempts are exceeded. Unable to connect to instance")
ErrUnableToConnect is returned when unable to connect to the postgres.
Functions ¶
This section is empty.
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
// contains filtered or unexported fields
}
ConnectionConfig is a configuration for postgres connection.
func NewConnectionConfig ¶
func NewConnectionConfig(host, port, dbname, username, password, sslmode string) ConnectionConfig
NewConnectionConfig creates a new ConnectionConfig.
type Option ¶
type Option func(*Postgres)
Option is a functional option for configuring a Postgres.
func WithConnAttempts ¶
WithConnAttempts sets the max attempts for connecting to the Postgres.
func WithConnTimeout ¶
WithConnTimeout sets the timeout for connecting to the Postgres.
func WithMaxPoolSize ¶
WithMaxPoolSize sets the max pool size for the Postgres.
type PgxPool ¶
type PgxPool interface { Close() Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, optionsAndArgs ...interface{}) pgx.Row }
PgxPool is a PostgreSQL connection pool.
Click to show internal directories.
Click to hide internal directories.