gorm

package module
v0.0.0-...-87b3bb6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BannedKeyword

type BannedKeyword struct {
	// Keyword represent the string watched, for example : "password"
	Keyword string
	// CaseMatters if set to false, the Keyword matching will occur depending on the case.
	// if set to true, Keyword will cd .strictly match input messages
	IsCaseSensitive bool
}

type LoggerGorm

type LoggerGorm struct {
	Logger *logrus.Logger
	Opt    *OptGorm
}

func New

func New(opt *OptGorm) (*LoggerGorm, error)

func (*LoggerGorm) Error

func (lm *LoggerGorm) Error(ctx context.Context, msg string, args ...interface{})

func (*LoggerGorm) Info

func (lm *LoggerGorm) Info(ctx context.Context, msg string, args ...interface{})

func (*LoggerGorm) LogMode

func (lm *LoggerGorm) LogMode(level logger.LogLevel) logger.Interface

LogMode implementation log mode.

func (*LoggerGorm) Trace

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

func (*LoggerGorm) Warn

func (lm *LoggerGorm) Warn(ctx context.Context, msg string, args ...interface{})

type OptGorm

type OptGorm struct {
	//ignore if not found error happened
	SkipErrRecordNotFound bool
	//slow sql threshold
	SlowThreshold time.Duration
	//record line number and filename
	IsHelper bool
	//replace sensitive word, such as password
	BKeywords []BannedKeyword

	// if set to true, it will add latency information for your queries
	LogLatency bool

	//gorm log level for automatically triggering
	//logrus log level is debug and don't need to modify
	LogLevel logger.LogLevel

	//logrus parameters
	OptLogrus *c.OptLog
}

func GetOpt

func GetOpt() *OptGorm

GetOpt

  • @msg get default values
  • @return: *OptGorm

Jump to

Keyboard shortcuts

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