gormx

package
v1.0.36 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecTrans

func ExecTrans(ctx context.Context, db *gorm.DB, fn TransFunc) error

ExecTrans 执行事务

func ExecTransWithLock

func ExecTransWithLock(ctx context.Context, db *gorm.DB, fn TransFunc) error

ExecTransWithLock 执行事务(加锁)

func GetDB

func GetDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetDB ...

func GetDBWithModel

func GetDBWithModel(ctx context.Context, defDB *gorm.DB, m interface{}) *gorm.DB

GetDBWithModel ...

Types

type Trans

type Trans struct {
	DB *gorm.DB
}

Trans 事务管理

func (*Trans) Exec

func (a *Trans) Exec(ctx context.Context, fn func(context.Context) error) error

Exec 执行事务

type TransFunc

type TransFunc func(context.Context) error

TransFunc 定义事务执行函数

Jump to

Keyboard shortcuts

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