mysql

package
v0.1.33 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDb added in v0.1.11

func GetDb() gorm.DB

Types

type Mysql

type Mysql struct {
	Host     string `yaml:"Host"`
	Port     int    `yaml:"Port"`
	Username string `yaml:"Username"`
	Password string `yaml:"Password"`
	Database string `yaml:"Database"`
}

func (*Mysql) Init added in v0.1.11

func (msl *Mysql) Init(opts ...Opts)

Init 初始化数据库

type Option added in v0.1.11

type Option struct {
	MaxIdleConns    int
	MaxOpenConns    int
	ConnMaxIdleTime time.Duration
	ConnMaxLifetime time.Duration
	// contains filtered or unexported fields
}

type Opts added in v0.1.11

type Opts func(*Option)

func WithConnMaxIdleTime added in v0.1.11

func WithConnMaxIdleTime(connMaxIdleTime time.Duration) Opts

func WithConnMaxLifetime added in v0.1.11

func WithConnMaxLifetime(connMaxLifetime time.Duration) Opts

func WithGormOption added in v0.1.11

func WithGormOption(config gorm.Config) Opts

func WithMaxIdleConns added in v0.1.11

func WithMaxIdleConns(maxIdleConns int) Opts

func WithMaxOpenConns added in v0.1.11

func WithMaxOpenConns(maxOpenConns int) Opts

Jump to

Keyboard shortcuts

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