Documentation
¶
Index ¶
- func Filter(sl []string, m map[string]string) (result []string)
- func NewPipeline() *pipeline
- func Pairs(kv []any) (map[string]any, error)
- func PairsHook(kv []any, ids map[string]any, hook string) (map[string]any, error)
- type Exec
- type ExecResult
- type Option
- func WithConnMax(maxOpenConns int) Option
- func WithConnMaxIdleTime(maxConnIdleTime time.Duration) Option
- func WithConnMaxLifetime(maxConnLifetime time.Duration) Option
- func WithDBName(dbName string) Option
- func WithDriverName(driverName string) Option
- func WithDsn(dsn string) Option
- func WithHost(host string) Option
- func WithMaxIdleConns(maxIdleConns int) Option
- func WithMaxOpenConns(maxOpenConns int) Option
- func WithPassword(password string) Option
- func WithPort(port int) Option
- func WithSSLMode(sslMode string) Option
- func WithUser(user string) Option
- type Postgres
- type Select
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecResult ¶
type ExecResult struct {
// contains filtered or unexported fields
}
ExecResult is the result of an exec query.
func (*ExecResult) TxResult ¶
func (e *ExecResult) TxResult(query string) any
type Option ¶
type Option func(*config)
Option is a function that configures the postgres database.
func WithConnMax ¶
WithConnMax sets the max conn. maxOpenConns is the maximum number of open connections to the database.
func WithConnMaxIdleTime ¶
WithConnMaxIdleTime sets the max conn idle time. maxConnIdleTime is the maximum amount of time a connection may be idle.
func WithConnMaxLifetime ¶
WithConnMaxLifetime sets the max conn lifetime. maxConnLifetime is the maximum amount of time a connection may be reused.
func WithDBName ¶
WithDBName sets the db name. dbName is the name of the database to connect to.
func WithDriverName ¶
WithDriverName sets the driver name.
func WithMaxIdleConns ¶
func WithMaxOpenConns ¶
WithMaxOpenConns sets the max open conns. maxOpenConns is the maximum number of open connections to the database.
func WithPassword ¶
WithPassword sets the password. password is the password to connect with.
func WithSSLMode ¶
WithSSLMode sets the ssl mode. sslMode is the SSL mode to use.
type Postgres ¶
type Postgres interface { Select(query string, dest any, kv ...any) Select Insert(query string, kv ...any) Exec Update(query string, kv ...any) Exec Delete(query string, kv ...any) Exec FromResult(from string) string }
Postgres is the interface for the postgres database client.
type Select ¶
type Select interface { Debug() Select One(ctx context.Context) (found bool, err error) Many(ctx context.Context) (found bool, err error) }
Select is an interface for selecting data from the database.
type StringSlice ¶
type StringSlice []string
func (*StringSlice) Scan ¶
func (s *StringSlice) Scan(src any) error