Documentation
¶
Overview ¶
Package database provides database instrumentation.
Index ¶
- func DriverNameWithQueriesLogging(driverName string, logger ctxd.Logger, statsTracker stats.Tracker) (string, error)
- func DriverNameWithTracing(driverName string) (string, error)
- func SetupStorage(cfg Config, logger ctxd.Logger, statsTracker stats.Tracker, ...) (*sqluct.Storage, error)
- func SetupStorageDSN(cfg Config, logger ctxd.Logger, statsTracker stats.Tracker, migrations fs.FS) (*sqluct.Storage, error)
- func WithQueriesLogging(dbConnector driver.Connector, logger ctxd.Logger, statsTracker stats.Tracker) driver.Connector
- func WithTracing(dbConnector driver.Connector) driver.Connector
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DriverNameWithQueriesLogging ¶ added in v0.1.13
func DriverNameWithQueriesLogging(driverName string, logger ctxd.Logger, statsTracker stats.Tracker) (string, error)
DriverNameWithQueriesLogging registers database driver name with query logging.
func DriverNameWithTracing ¶ added in v0.1.13
DriverNameWithTracing registers database driver name with OpenCensus tracing.
func SetupStorage ¶
func SetupStorage(cfg Config, logger ctxd.Logger, statsTracker stats.Tracker, conn driver.Connector, migrations fs.FS) (*sqluct.Storage, error)
SetupStorage initializes database pool and prepares storage.
func SetupStorageDSN ¶ added in v0.1.13
func SetupStorageDSN(cfg Config, logger ctxd.Logger, statsTracker stats.Tracker, migrations fs.FS) (*sqluct.Storage, error)
SetupStorageDSN initializes database pool and prepares storage.
Types ¶
type Config ¶
type Config struct {
DriverName string `split_words:"true"`
DSN string `required:"true"`
MaxLifetime time.Duration `split_words:"true" default:"4h"`
MaxIdle int `split_words:"true" default:"5"`
MaxOpen int `split_words:"true" default:"5"`
InitConn bool `split_words:"true"`
ApplyMigrations bool `split_words:"true"`
}
Config describes database pool.
Click to show internal directories.
Click to hide internal directories.