util

package
v0.0.0-...-3363d21 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TransSet = wire.NewSet(wire.Struct(new(Trans), "*"))

Functions

func ExecTrans

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

func ExecTransWithLock

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

func GetDB

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

func GetDBWithModel

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

func GetPages

func GetPages(db *gorm.DB, out interface{}, pageNum, pageSize int) (int64, error)

GetPages 分页返回数据

Types

type Model

type Model struct {
	ID        uint64 `gorm:"primaryKey;"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Trans

type Trans struct {
	DB *gorm.DB
}

func (*Trans) Exec

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

type TransFunc

type TransFunc func(context.Context) error

Jump to

Keyboard shortcuts

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