Documentation ¶
Index ¶
- func Close() error
- func GetDB() *gorm.DB
- func InitDB(opts ...Option) error
- func NewMySQL(opts ...Option) (*gorm.DB, error)
- func SetDefaultDB(db *gorm.DB)
- type Option
- func Addr(addr string) Option
- func ConnMaxLifetime(d time.Duration) Option
- func DBName(db string) Option
- func DSN(dsn string) Option
- func Debug(b bool) Option
- func IdleTimeout(d time.Duration) Option
- func MaxConns(i int) Option
- func MaxIdleConns(i int) Option
- func Password(password string) Option
- func User(user string) Option
- func WithConfig(cfg *configv1.MySQL) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultDB ¶
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 ConnMaxLifetime ¶
func IdleTimeout ¶
func MaxIdleConns ¶
func WithConfig ¶
Click to show internal directories.
Click to hide internal directories.