db

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 15 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 {
	Driver   string
	Host     string
	User     string
	Password string
	Database string
	Debug    bool
	Logger   Logger
}

Config 数据库配置项

host: 127.0.0.1:3306

user: root
password: 123456
database: supervision

func (*Config) Gorm

func (conf *Config) Gorm() (*gorm.DB, error)

Gorm 初始化 gorm,返回 gorm 实例

func (*Config) Xorm

func (conf *Config) Xorm() (*xorm.Engine, error)

Xorm 初始化Xorm

type GormLogger added in v1.0.3

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

func (*GormLogger) Error added in v1.0.8

func (g *GormLogger) Error(ctx context.Context, key string, val ...interface{})

Error implements logger.Interface.

func (*GormLogger) Info added in v1.0.8

func (g *GormLogger) Info(context.Context, string, ...interface{})

Info implements logger.Interface.

func (*GormLogger) LogMode added in v1.0.8

LogMode implements logger.Interface.

func (*GormLogger) Print added in v1.0.3

func (g *GormLogger) Print(v ...interface{})

func (*GormLogger) Trace added in v1.0.8

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

Trace implements logger.Interface.

func (*GormLogger) Warn added in v1.0.8

func (g *GormLogger) Warn(ctx context.Context, key string, val ...interface{})

Warn implements logger.Interface.

type Logger added in v1.0.3

type Logger interface {
	Debug(...interface{})
	Debugf(string, ...interface{})
	Error(...interface{})
	Errorf(string, ...interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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