database

package
v0.0.0-...-6302c98 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDb

func GetDb() *gorm.DB

GetDb 获取默认数据库操作对象

func GetDbByName

func GetDbByName(name string) *gorm.DB

GetDbByName 获取数据库操作对象

func InitDataSource

func InitDataSource(dbConfigs map[string]config.DBConfig)

InitDataSource 初始化db

func NewLogger

func NewLogger(log *logger.AppLogger, config glog.Config, zapFields ...zap.Field) glog.Interface

func NewSkyWalkingPlugin

func NewSkyWalkingPlugin(opts ...applyOption) gorm.Plugin

New constructs a new plugin based opentracing. It supports to trace all operations in gorm, so if you have already traced your servers, now this plugin will perfect your tracing job.

func WithErrorTagHook

func WithErrorTagHook(errorTagHook errorTagHook) applyOption

func WithLogResult

func WithLogResult(logResult bool) applyOption

WithLogResult enable opentracingPlugin to log the result of each executed sql.

func WithSqlParameters

func WithSqlParameters(logSqlParameters bool) applyOption

func WithTracer

func WithTracer(tracer *go2sky.Tracer) applyOption

WithTracer allows to use customized tracer rather than the global one only.

func WithUrl

func WithUrl(url string) applyOption

WithUrl allows to use customized tracer rather than the global one only.

Types

type Logger

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

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 glog.LogLevel) glog.Interface

LogMode log mode

func (Logger) Trace

func (l Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, 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