database

package
v0.0.0-...-cfe1fa9 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMysqlDb

func GetMysqlDb(dbConfig *DbConfig) (*gorm.DB, error)

GetMysqlDb get instance

Types

type DbConfig

type DbConfig struct {
	User            string        `json:"user"`
	Password        string        `json:"password"`
	Host            string        `json:"host"`
	Port            uint32        `json:"port"`
	Database        string        `json:"database"`
	Charset         string        `json:"charset"`
	ParseTime       bool          `json:"parse_time"`
	MaxIdleConns    int           `json:"max_idle_conns"`    //MaxIdleConns 设置空闲连接池中连接的最大数量
	MaxOpenConns    int           `json:"max_open_conns"`    //MaxOpenConns 设置打开数据库连接的最大数量
	ConnMaxLifetime time.Duration `json:"conn_max_lifetime"` //ConnMaxLifetime 设置了连接可复用的最大时间
}

Jump to

Keyboard shortcuts

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