Documentation
¶
Index ¶
- Variables
- func Ctx(ctx context.Context) (*sql.DB, error)
- func MySQLLogger(slowQueryThreshold time.Duration) func(context.Context, mysql.QueryInfo)
- func New(ctx context.Context, cfg *Configuration) (context.Context, error)
- func PostgresLogger(slowQueryThreshold time.Duration) func(context.Context, postgres.QueryInfo)
- func TranslateError(err error) error
- func WithContext(parent context.Context, db *sql.DB) (ctx context.Context)
- type Configuration
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func MySQLLogger ¶ added in v0.0.2
func PostgresLogger ¶ added in v0.0.2
func TranslateError ¶
Types ¶
type Configuration ¶
type Configuration struct {
Driver string `description:"Database driver"`
DSN string `description:"Database connection string"`
SlowQueryThreshold time.Duration `description:"Threshold for logging slow queries"`
ConnMaxIdleTime time.Duration `description:"Maximum amount of time a connection may be idle before being closed"`
ConnMaxLifetime time.Duration `description:"Maximum amount of time a connection may be reused"`
MaxIdleConns int `description:"Maximum number connections in the idle connection pool"`
MaxOpenConns int `description:"Maximum number of open connections to the database"`
}
func NewConfiguration ¶
func NewConfiguration() *Configuration
Click to show internal directories.
Click to hide internal directories.