dborm

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotActive = fmt.Errorf("db manager is not active")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Username       string        `yaml:"username" json:"username"`
	Password       string        `yaml:"password" json:"password"`
	Dbname         string        `yaml:"dbname" json:"dbname"`
	Host           string        `yaml:"host" json:"host"`
	Port           int           `yaml:"port" json:"port"`
	MaxOpenConn    int           `yaml:"max_open_conn" json:"max_open_conn" default:"10"`
	MaxIdleConn    int           `yaml:"max_idle_conn" json:"max_idle_conn" default:"5"`
	MaxLifetime    time.Duration `yaml:"max_lifetime" json:"max_lifetime" default:"300s"`
	EnableTracking bool          `yaml:"enable_tracking" json:"enable_tracking" default:"true"`
}

func (*Config) GetDSN

func (dc *Config) GetDSN() string

type Manager

type Manager interface {
	GetDB(ctx context.Context) (*gorm.DB, error)
	Active() bool
}

func NewManager

func NewManager(
	cfg *Config,
) (Manager, error)

Jump to

Keyboard shortcuts

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