database

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 19 Imported by: 1

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, 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"`

	// MethodSkipPackages provides helper package paths to skip when identifying method name for observability.
	// Item example: "github.com/jmoiron/sqlx".
	MethodSkipPackages []string
}

Config describes database pool.

Jump to

Keyboard shortcuts

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