orm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Master *ConfigItem   `json:"master"`
	Slaves []*ConfigItem `json:"slaves"`
}

type ConfigItem

type ConfigItem struct {
	Host         string `json:"host"`
	Port         int    `json:"port"`
	Database     string `json:"database"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	MaxIdleConns int    `json:"maxIdleConns"`
	MaxOpenConns int    `json:"maxOpenConns"`
}

type GormDBManager

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

func NewGormDBManager

func NewGormDBManager(configPath string, logger *log.Helper) *GormDBManager

func (*GormDBManager) MasterDB

func (g *GormDBManager) MasterDB() *gorm.DB

func (*GormDBManager) SlaveDB

func (g *GormDBManager) SlaveDB() *gorm.DB

type Logger

type Logger struct {
	*log.Helper
	logger.Config
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(helper *log.Helper, config logger.Config) *Logger

func (*Logger) Error

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

func (*Logger) Info

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

func (*Logger) LogMode

func (l *Logger) LogMode(level logger.LogLevel) logger.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, data ...interface{})

Jump to

Keyboard shortcuts

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