mysql

package
v0.0.0-...-a00ab96 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Read struct {
		Addr string `toml:"addr"`
		User string `toml:"user"`
		Pass string `toml:"pass"`
		Name string `toml:"name"`
	} `toml:"read"`
	Write struct {
		Addr string `toml:"addr"`
		User string `toml:"user"`
		Pass string `toml:"pass"`
		Name string `toml:"name"`
	} `toml:"write"`
	Base struct {
		MaxOpenConn     int           `toml:"maxOpenConn"`
		MaxIdleConn     int           `toml:"maxIdleConn"`
		ConnMaxLifeTime time.Duration `toml:"connMaxLifeTime"`
	} `toml:"base"`
}

func NewConfig

func NewConfig() *Config

func (*Config) SetBase

func (c *Config) SetBase(maxOpenConn, maxIdleConn int, maxLifeTime time.Duration) *Config

func (*Config) SetRead

func (c *Config) SetRead(addr, name, user, pwd string) *Config

func (*Config) SetWrite

func (c *Config) SetWrite(addr, name, user, pwd string) *Config

type Repo

type Repo interface {
	GetDbR() *gorm.DB
	GetDbW() *gorm.DB
	DbRClose() error
	DbWClose() error
	// contains filtered or unexported methods
}

func New

func New(config *Config) (Repo, error)

Jump to

Keyboard shortcuts

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