Versions in this module Expand all Collapse all v0 v0.4.0 Nov 14, 2019 Changes in this version + const MaxIdleConnsKey + const MaxOpenConnsKey + var ErrDataInvalid = serrors.New("db: db data invalid") + var ErrInvalidInputData = serrors.New("db: input data invalid") + var ErrReadFailed = serrors.New("db: read failed") + var ErrTx = serrors.New("db: transaction error") + var ErrWriteFailed = serrors.New("db: write failed") + func ConfiguredMaxIdleConns(cfg map[string]string) (int, bool) + func ConfiguredMaxOpenConns(cfg map[string]string) (int, bool) + func DeleteInTx(ctx context.Context, db Sqler, delFunc func(tx *sql.Tx) (sql.Result, error)) (int, error) + func DoInTx(ctx context.Context, db Sqler, action func(context.Context, *sql.Tx) error) error + func ErrToMetricLabel(err error) string + func NewDataError(msg common.ErrMsg, err error, logCtx ...interface{}) error + func NewInputDataError(msg common.ErrMsg, err error, logCtx ...interface{}) error + func NewReadError(msg common.ErrMsg, err error, logCtx ...interface{}) error + func NewSqlite(path string, schema string, schemaVersion int) (*sql.DB, error) + func NewTxError(msg common.ErrMsg, err error, logCtx ...interface{}) error + func NewWriteError(msg common.ErrMsg, err error, logCtx ...interface{}) error + func SetConnLimits(cfg LimitConfig, db LimitSetter) + func ValidateConfigLimits(cfg map[string]string) error + type LimitConfig interface + MaxIdleConns func() (int, bool) + MaxOpenConns func() (int, bool) + type LimitSetter interface + SetMaxIdleConns func(maxIdleConns int) + SetMaxOpenConns func(maxOpenConns int) + type Sqler interface + ExecContext func(context.Context, string, ...interface{}) (sql.Result, error) + QueryContext func(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext func(context.Context, string, ...interface{}) *sql.Row