mysql

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB added in v0.0.18

func NewDB() libs.GDB

NewDB 创建mysql实例

func NewMultiDB added in v0.0.18

func NewMultiDB(defaultDB libs.GDB) libs.MultiDB

Types

type DB

type DB struct {
	Name     string `json:"name" yaml:"name"`
	LogFile  string `json:"log_file" json:"log_file"`
	LogLevel string `json:"log_level" yaml:"log_level"`

	Host     string `json:"host" yaml:"host"`
	Port     string `json:"port" yaml:"port"`
	DBName   string `json:"dbname" yaml:"dbname"`
	UserName string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`

	MaxIdleTime int `json:"max_idle_time" yaml:"max_idle_time"`
	MaxLifeTime int `json:"max_life_time" yaml:"max_life_time"`
	MaxOpenConn int `json:"max_open_conn" yaml:"max_open_conn"`
	MaxIdleConn int `json:"max_idle_conn" yaml:"max_idle_conn"`
	// contains filtered or unexported fields
}

DB mysql实例

func (*DB) Client

func (this *DB) Client() *gorm.DB

Client 获取数据库连接

func (*DB) Conn

func (this *DB) Conn() error

Conn 连接数据库

type MultiDB added in v0.0.18

type MultiDB struct {
	DefaultDB libs.GDB
	MultiDB   map[string]*DB
}

func (*MultiDB) AddGDB added in v0.0.18

func (this *MultiDB) AddGDB(name string, db libs.GDB)

func (*MultiDB) GetDB added in v0.0.18

func (this *MultiDB) GetDB(name string) libs.GDB

func (*MultiDB) GetDefaultDB added in v0.0.18

func (this *MultiDB) GetDefaultDB() libs.GDB

Jump to

Keyboard shortcuts

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