database

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package database provides database instrumentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupStorage

func SetupStorage(cfg Config, logger ctxd.Logger, driverName string, conn driver.Connector, migrations fs.FS) (*sqluct.Storage, error)

SetupStorage initializes database pool and prepares storage.

func WithQueriesLogging

func WithQueriesLogging(dbConnector driver.Connector, logger ctxd.Logger) driver.Connector

WithQueriesLogging instruments database connector with query logging.

func WithTracing

func WithTracing(dbConnector driver.Connector) driver.Connector

WithTracing instruments database connector with OpenCensus tracing.

Types

type Config

type Config struct {
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL