db

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(cf *MySqlConfig) *gorm.DB

NewDB 初始化 MySQL 链接

func NewDBWithAPM

func NewDBWithAPM(cf *MySqlConfig) *gorm.DB

NewDBWithAPM 初始化 MySQL 链接

Types

type MySqlConfig

type MySqlConfig struct {
	DNS string `json:"dns"`
	// Host Port User Password DB build DNS
	Host     string `json:"host"`
	Port     string `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	DB       string `json:"db"`
	// Debug开关
	Debug bool `json:"debug" yaml:"debug" default:"false"`
	// 最大空闲连接数
	MaxIdleConns int `json:"maxIdleConns" yaml:"maxIdleConns" default:"10"`
	// 最大活动连接数
	MaxOpenConns int `json:"maxOpenConns" yaml:"maxOpenConns" default:"100"`
	// 连接的最大存活时间
	ConnMaxLifetime time.Duration `json:"connMaxLifetime" yaml:"connMaxLifetime" default:"0"`
}

Jump to

Keyboard shortcuts

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