Documentation ¶
Index ¶
- func Connect(ctx context.Context, dsn string, attempts int32) (*pgxpool.Pool, error)
- func CreateDsn(dsn *cfg.DBConfig) string
- func DBTearDown(conf *cfg.Config) error
- func InitDB(conf *cfg.DBConfig, log *zerolog.Logger) error
- func IsNotNull(value interface{}) bool
- func Migrate(ctx context.Context, log *zerolog.Logger, conf *cfg.Config, paths ...string) error
- func Sanitize(s []string) []string
- func SerialParametrizedUnaryTx(ctx context.Context, conn *pgxpool.Pool, qName, sql string, errorInput any, ...) error
- func SerializableParametrizedTx[T any](ctx context.Context, conn *pgxpool.Pool, qName, sql string, ...) (dest []T, err error)
- func TxErr(action string, input interface{}, err error) error
- type Connection
- type Connector
- type MaybeSeq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Currently only postgres is supported, as we try to stick to YAGNI and convetion over configuration.
func DBTearDown ¶ added in v0.7.0
DBTearDown is a helper function to clean up the test database
func IsNotNull ¶ added in v0.8.0
func IsNotNull(value interface{}) bool
IsNotNull returns true if a value is not "nullish" falsity is not considered nullish
func Migrate ¶
Migrate runs the migrations located in the migrations folder paths is a variadic argument, meaning that if no specific path(s) are provided, the program will try to run all of them Otherwise the arguments to path should only include the containing directory name for each migration, e.g. "000001-fix-missing-timestamps"
func SerialParametrizedUnaryTx ¶ added in v0.9.19
func SerialParametrizedUnaryTx( ctx context.Context, conn *pgxpool.Pool, qName, sql string, errorInput any, params ...any, ) error
like SerializableParametrizedTx, but doesn't scan into anything, instead simply returning an error