mysql

package
v0.0.0-...-3d2f39d Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMySQLDB

func NewMySQLDB(cfg Config) (*gorm.DB, error)

NewMySQLDB creates the mysql master/slaves cluster.

Types

type Config

type Config struct {
	Master       Conn   `yaml:"master"`
	Slaves       []Conn `yaml:"slaves"`
	MaxOpenConns int    `yaml:"max_open_conns"`
	MaxIdleConns int    `yaml:"max_idle_conns"`
	LogLevel     string `yaml:"log_level"`
}

Config defines mysql configuration.

type Conn

type Conn struct {
	Host     string `yaml:"host"`
	Port     uint   `yaml:"port"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	DBName   string `yaml:"db_name"`
}

Jump to

Keyboard shortcuts

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