mysql

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Reader *gorm.DB
	Writer *gorm.DB
}

func NewDB

func NewDB(readerConfig, writerConfig *DBConfig) (*DB, error)

func NewDBInConfig

func NewDBInConfig(logFilename string) (*DB, error)

func (*DB) AutoMigrate

func (db *DB) AutoMigrate(dst ...interface{}) error

func (*DB) Close

func (db *DB) Close() error

func (*DB) CloseReader

func (db *DB) CloseReader() error

func (*DB) CloseWriter

func (db *DB) CloseWriter() error

func (*DB) EnableLog

func (db *DB) EnableLog(enable bool)

type DBConfig

type DBConfig struct {
	User                string
	Password            string
	Addr                string
	DBName              string
	MaxOpenConnections  int
	MaxIdleConnections  int
	MaxLifetimeDuration time.Duration
	LogFilename         string
	Log                 bool
}

type Logger

type Logger struct {
	gormLogger.Config
	// contains filtered or unexported fields
}

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, values ...interface{})

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, values ...interface{})

func (*Logger) LogMode

func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, values ...interface{})

Jump to

Keyboard shortcuts

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