mysqlclient

package
v0.0.0-...-0569e1c Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

** implement logger.Interface

// Interface logger interface
type Interface interface {
	LogMode(LogLevel) Interface
	Info(context.Context, string, ...interface{})
	Warn(context.Context, string, ...interface{})
	Error(context.Context, string, ...interface{})
	Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
}

Index

Constants

View Source
const (
	Reset       = "\033[0m"
	Red         = "\033[31m"
	Green       = "\033[32m"
	Yellow      = "\033[33m"
	Blue        = "\033[34m"
	Magenta     = "\033[35m"
	Cyan        = "\033[36m"
	White       = "\033[37m"
	BlueBold    = "\033[34;1m"
	MagentaBold = "\033[35;1m"
	RedBold     = "\033[31;1m"
	YellowBold  = "\033[33;1m"
)

Variables

This section is empty.

Functions

func MysqlClientManagerInit

func MysqlClientManagerInit(configs []MysqlClientConfig) error

func NewMysqlClient

func NewMysqlClient(c MysqlClientConfig) (*gorm.DB, error)

Types

type MysqlClientConfig

type MysqlClientConfig struct {
	Name         string // 名称 master slave memory
	URL          string // dsn
	IdleSize     int
	MaxSize      int
	MaxLifeTime  int64
	SqlDebug     int
	InnoModels   []interface{}
	MyisamModels []interface{}
	MemoryModels []interface{}
}

type MysqlClientManager

type MysqlClientManager struct {
	// contains filtered or unexported fields
}

func GetMysqlClientManager

func GetMysqlClientManager() *MysqlClientManager

func (*MysqlClientManager) GetMysqlClient

func (r *MysqlClientManager) GetMysqlClient(name string) *gorm.DB

type SqlLogger

type SqlLogger struct {
	SqlDebug int
}

func (*SqlLogger) Error

func (s *SqlLogger) Error(ctx context.Context, msg string, data ...interface{})

func (*SqlLogger) Info

func (s *SqlLogger) Info(ctx context.Context, msg string, data ...interface{})

func (*SqlLogger) LogMode

func (s *SqlLogger) LogMode(level logger.LogLevel) logger.Interface

func (*SqlLogger) Trace

func (s *SqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

func (*SqlLogger) Warn

func (s *SqlLogger) Warn(ctx context.Context, msg string, data ...interface{})

Jump to

Keyboard shortcuts

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