gormkit

package
v0.0.0-...-8ef2ba3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSetupHost = errors.New("setup host in database config")
	ErrSetupName = errors.New("setup name in database config")
)

Functions

func NewGorm

func NewGorm(cfg Config) (*gorm.DB, func(), error)

Types

type Config

type Config struct {
	Name     string
	User     string `default:"postgres"`
	Password string `default:""`
	Host     string
	Port     string `default:"5432"`

	MaxOpenConns    int           `yaml:"max_open_conns" default:"0"`
	MaxIdleConns    int           `yaml:"max_idle_conns" default:"2"`
	ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime" default:"1m"`

	Colorful      bool
	DisableLogger bool
	Logger        *zap.Logger
}

func (Config) ToString

func (ds Config) ToString() (string, error)

Jump to

Keyboard shortcuts

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