mysql

package
v0.1.77 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DbConnects map[string]*gorm.DB
	DB         *gorm.DB // 主库(主要为了兼容以前的版本)
)

Functions

func Get added in v0.1.75

func Get(connName string) *gorm.DB

func Initialization added in v0.1.75

func Initialization(c Configure2) error

func Initialize

func Initialize(c Configure) error

Types

type Config

type Config struct {
	Host         string // 数据库连接地址
	Port         int    // 端口
	UserName     string // 用户名
	PassWord     string // 密码
	DataBaseName string // 库名
	UseMetrics   bool   // 是否使用metrics
	ConnName     string // 连接名
}

type Configure

type Configure interface {
	GetConfigs() []*Config
}

type Configure2 added in v0.1.75

type Configure2 interface {
	GetConfigs2() []*ConnConfig
}

type ConnConfig added in v0.1.75

type ConnConfig struct {
	ConnName string
	Write    *Config
	Read     *Config
}

Jump to

Keyboard shortcuts

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