mysql

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(key ...string) *sqlx.DB

DB 根据名称获取数据库连接

func Init

func Init()

Init 初始化mysql

func RegisterDataBase

func RegisterDataBase(aliasName, driverName, dataSource string, params ...int)

RegisterDataBase 注册mysql数据库

func ShowDataBase

func ShowDataBase()

ShowDataBase 展示数据库信息

Types

type Config

type Config struct {
	Name     string `mapstructure:"name"`     // 连接名称
	Host     string `mapstructure:"host"`     // 主机地址
	Port     int    `mapstructure:"port"`     // 连接端口号
	DB       string `mapstructure:"db"`       // 数据库名称
	User     string `mapstructure:"user"`     // 用户名
	Password string `mapstructure:"password"` // 密码
	MaxIDLE  int    `mapstructure:"max_idle"` // 最大空闲数
	MaxOpen  int    `mapstructure:"max_open"` // 最大连接数
	Timeout  int    `mapstructure:"timeout"`  // 连接超时
}

Config mysql 配置信息

Jump to

Keyboard shortcuts

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