mysql

package
v0.0.0-...-c0d1fdb Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(dbName string) (*gorm.DB, error)

func DefaultDB

func DefaultDB() (*gorm.DB, error)

func Init

func Init(options ...Option)

Types

type Option

type Option struct {
	Host            string `json:"host"`              // HOST
	Port            int    `json:"port"`              // 端口
	DBName          string `json:"db_name"`           // 数据库名称
	Username        string `json:"username"`          // 用户名
	Password        string `json:"password"`          // 密码
	Params          string `json:"params"`            // 连接参数
	MaxIdleConns    int    `json:"max_idle_conns"`    // 连接池:最大空闲连接数量
	MaxOpenConns    int    `json:"max_open_conns"`    // 连接池:最大打开连接数量
	ConnMaxLifetime int    `json:"conn_max_lifetime"` // 连接池:连接最大可复用时间(单位:秒)
}

Jump to

Keyboard shortcuts

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