iorm

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrZeroOrEmptyValue    = errors.New("value must not be zero or empty")
	ErrObjectAlreadyExist  = errors.New("object already exist")
	ErrHasAssociation      = errors.New("object has associate other object")
	ErrOperateNotPermitted = errors.New("operate not permitted")
	ErrOutOfRange          = errors.New("out of range")
	ErrInvalidParameter    = errors.New("invalid parameter")
	ErrConflict            = errors.New("data field conflict")
)

基本错误

Functions

func CtxDB added in v0.3.0

func CtxDB(ctx context.Context) func(db *gorm.DB) *gorm.DB

CtxDB ctx db 如果上下文中有事务,返回事务,否则使用db

func Paginate added in v0.3.0

func Paginate(pg paginator.Param) func(db *gorm.DB) *gorm.DB

Paginate paginate

func QueryPages added in v0.2.6

func QueryPages(db *gorm.DB, pg paginator.Param, out interface{}) (paginator.Info, error)

QueryPages 分页查询 db需提供model和条件, list需提供切片地址 如 &[]yourStruct{} pg 如果均为默认参数,将不进行分页查询,将返回所有数据

func QueryPagesAssociation added in v0.2.6

func QueryPagesAssociation(db *gorm.DB, pg paginator.Param, out interface{}, column string) (paginator.Info, error)

QueryPagesAssociation query page association

Types

This section is empty.

Directories

Path Synopsis
Package trans gorm 事务封装
Package trans gorm 事务封装

Jump to

Keyboard shortcuts

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