db

package
v0.29.11 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MigrationsRoot   = "db/migrations"
	DefaultListLimit = 50
	MaxListLimit     = 100
)

Variables

This section is empty.

Functions

func AdjustListLimit

func AdjustListLimit(limit, offset int) (int, int)

Types

type DB

type DB struct {
	Pool *pgxpool.Pool
	// contains filtered or unexported fields
}

func NewDB

func NewDB(config DBConfig, serviceName string) (*DB, error)

func (*DB) Close

func (db *DB) Close()

type DBConfig

type DBConfig struct {
	Enabled           bool          `yaml:"enabled"`
	Username          string        `yaml:"username"`
	Password          string        `yaml:"password"`
	Database          string        `yaml:"database"`
	Hostname          string        `yaml:"hostname"`
	Port              int           `yaml:"port"`
	MaxConns          int32         `yaml:"maxConns"`
	MinConns          int32         `yaml:"minConns"`
	MaxConnIdleTime   time.Duration `yaml:"maxConnIdleTime"`
	MaxConnLifetime   time.Duration `yaml:"maxConnLifetime"`
	HealthCheckPeriod time.Duration `yaml:"healthCheckPeriod"`
}

func (*DBConfig) ConnString

func (c *DBConfig) ConnString() string

func (*DBConfig) SetDefaults

func (c *DBConfig) SetDefaults()

Jump to

Keyboard shortcuts

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