db

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(bean interface{}) error

Create inserts a record into the database

func Initialize

func Initialize(cfg *config.MySQL) error

Initialize initialize the database

func Tx

func Tx(fc func(tx *gorm.DB) error, opts ...*sql.TxOptions) error

Tx start a transaction as a block, return error will rollback, otherwise to commit.

Types

type Logger

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

Logger is the customized logger for gorm

func (*Logger) Error

func (l *Logger) Error(_ context.Context, format string, args ...interface{})

Error implements the logger.Interface interface

func (*Logger) Info

func (l *Logger) Info(_ context.Context, format string, args ...interface{})

Info implements the logger.Interface interface

func (*Logger) LogMode

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

LogMode implements the logger.Interface interface

func (*Logger) Trace

func (l *Logger) Trace(_ context.Context, _ time.Time, fc func() (string, int64), err error)

Trace implements the logger.Interface interface

func (*Logger) Warn

func (l *Logger) Warn(_ context.Context, format string, args ...interface{})

Warn implements the logger.Interface interface

Directories

Path Synopsis
Code generated by go-queryset.
Code generated by go-queryset.

Jump to

Keyboard shortcuts

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