mysql

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close db.

func GetDB

func GetDB() *gorm.DB

func InitDB

func InitDB(opts ...Option) error

func NewMySQL

func NewMySQL(opts ...Option) (*gorm.DB, error)

func SetDefaultDB

func SetDefaultDB(db *gorm.DB)

SetDefaultDB set default db, If you want to use default db, you can just use GetDB() If called InitDB, you don't need to call this function.

Types

type Option

type Option func(*option)

func Addr

func Addr(addr string) Option

func ConnMaxLifetime

func ConnMaxLifetime(d time.Duration) Option

func DBName

func DBName(db string) Option

func DSN

func DSN(dsn string) Option

func Debug

func Debug(b bool) Option

func IdleTimeout

func IdleTimeout(d time.Duration) Option

func MaxConns

func MaxConns(i int) Option

func MaxIdleConns

func MaxIdleConns(i int) Option

func Password

func Password(password string) Option

func User

func User(user string) Option

func WithConfig

func WithConfig(cfg *configv1.MySQL) Option

Jump to

Keyboard shortcuts

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