dbcore

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromTrans

func FromTrans(ctx context.Context) (interface{}, bool)

FromTrans 从上下文中获取事务

func FromTransLock

func FromTransLock(ctx context.Context) bool

FromTransLock 从上下文中获取事务锁

func NewTrans

func NewTrans(ctx context.Context, trans interface{}) context.Context

NewTrans 创建事务的上下文

func NewTransLock

func NewTransLock(ctx context.Context) context.Context

NewTransLock 创建事务锁的上下文

Types

type DAO

type DAO struct {
	*xorm.Engine
}

func (*DAO) ExecTrans

func (repo *DAO) ExecTrans(ctx context.Context, fn TransFunc) error

ExecTrans 执行事务

func (*DAO) GetDB

func (repo *DAO) GetDB(ctx context.Context) *xorm.Session

GetDB 获取db

func (*DAO) Save

func (repo *DAO) Save(ctx context.Context, bean interface{}) error

Inserts 批量插入

func (*DAO) SaveBatch

func (repo *DAO) SaveBatch(ctx context.Context, bean interface{}) error

SaveBatch 批量保存

func (*DAO) UpdateByID

func (repo *DAO) UpdateByID(ctx context.Context, bean interface{}, id interface{}, cols ...string) error

Update 报错

type TransFunc

type TransFunc func(context.Context) error

TransFunc 定义事务执行函数

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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