db

package
v0.0.0-...-ea68c78 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBNil = errors.New("ErrDBNil")
View Source
var (
	// ErrDuplicateEntryCode
	ErrDuplicateEntryCode = 1062
)
View Source
var ErrGetDBFailed = errors.New("ErrGetDBFailed")

Functions

func BindDbContext

func BindDbContext(parent context.Context, db *gorm.DB) context.Context

func GetDb

func GetDb(ctx context.Context) *gorm.DB

func IsMysqlDuplicateErr

func IsMysqlDuplicateErr(err error) bool

IsMysqlDuplicateErr 检查当前的err是否是重复键错误

func MysqlErrCode

func MysqlErrCode(err error) int

MysqlErrCode 根据mysql错误信息返回错误代码

func NewDB

func NewDB() *gorm.DB

func Transaction

func Transaction(c context.Context, f txFunc) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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