Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultMaxConns = 16 DefaultMinConns = 0 DefaultLogLevel = tracelog.LogLevelError )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Host string `mapstructure:"host"` // Default is 127.0.0.1
Port string `mapstructure:"port"` // Default is 5432
User string `mapstructure:"user"` // Default is empty
Password string `mapstructure:"password"` // Default is empty
DBName string `mapstructure:"db_name"` // Default is postgres
SSLMode string `mapstructure:"ssl_mode"` // Default is prefer
URL string `mapstructure:"url"` // If URL is provided, other fields are ignored
MaxConns int32 `mapstructure:"max_conns"` // Default is 16
MinConns int32 `mapstructure:"min_conns"` // Default is 0
Debug bool `mapstructure:"debug"`
}
func (Config) QueryTracer ¶
func (conf Config) QueryTracer() pgx.QueryTracer
type DB ¶
type DB interface {
Queryable
TxQueryable
SendBatch(ctx context.Context, b *pgx.Batch) (br pgx.BatchResults)
Ping(ctx context.Context) error
}
DB is an interface that can be used to execute queries and commands, and also to send batches
type Queryable ¶
type Queryable interface {
Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
Query(context.Context, string, ...interface{}) (pgx.Rows, error)
QueryRow(context.Context, string, ...interface{}) pgx.Row
}
Queryable is an interface that can be used to execute queries and commands
Click to show internal directories.
Click to hide internal directories.