config

package
v0.0.0-...-48595db Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MySQLMaxLifetime         = 59 * time.Second
	MySQLDefaultMaxConn      = 100
	MySQLDefaultTimeout      = 1
	MySQLDefaultReadTimeout  = 5
	MySQLDefaultWriteTimeout = 5
)

Variables

This section is empty.

Functions

func LoadTOML

func LoadTOML(filename string, obj any) error

LoadTOML load toml file to obj

Types

type MySQLConf

type MySQLConf struct {
	Host         string `toml:"host" yaml:"host"`
	Port         int    `toml:"port" yaml:"port"`
	DB           string `toml:"db" yaml:"db"`
	User         string `toml:"user" yaml:"user"`
	Password     string `toml:"password" yaml:"password"`
	Timeout      int    `toml:"timeout" yaml:"timeout"`
	ReadTimeout  int    `toml:"read_timeout" yaml:"read_timeout"`
	WriteTimeout int    `toml:"write_timeout" yaml:"write_timeout"`
	MaxConn      int    `toml:"max_conn" yaml:"max_conn"`
}

func (*MySQLConf) DSN

func (conf *MySQLConf) DSN() string

func (*MySQLConf) Gen

func (conf *MySQLConf) Gen() (*sql.DB, error)

func (*MySQLConf) GenSession

func (conf *MySQLConf) GenSession() (db.Session, error)

func (*MySQLConf) String

func (conf *MySQLConf) String() string

Jump to

Keyboard shortcuts

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