db

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(dbtype, host string, port int, dbname, user, password, extraParamStr, logLevelStr string) (*gorm.DB, error)

Init initializes a database connection and sets up package global DB var to be usable through the rest of the application

Types

type GormLogger

type GormLogger struct {
	LogLevel                  logger.LogLevel
	IgnoreRecordNotFoundError bool
	SlowThreshold             time.Duration
	LogTrace                  bool
}

GormLogger struct

func (GormLogger) Error

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

Error print error messages

func (GormLogger) Info

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

Info print info

func (*GormLogger) LogMode

func (l *GormLogger) LogMode(level logger.LogLevel) logger.Interface

LogMode log mode

func (*GormLogger) Print

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

Print - Log Formatter

func (GormLogger) Trace

func (l GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

Trace print sql message

func (GormLogger) Warn

func (l GormLogger) Warn(ctx context.Context, msg string, data ...interface{})

Warn print warn messages

Jump to

Keyboard shortcuts

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