contexts

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrContextNotFoundGorm 上下文不存在Gorm错误
	ErrContextNotFoundGorm = errors.New("上下文中没有获取到Gorm")
)
View Source
var (
	// ErrUserIDNotFound ...
	ErrUserIDNotFound = errors.New("上下文中,用户ID不存在")
)

Functions

func CheckGormTranContextExist

func CheckGormTranContextExist(ctx context.Context) bool

CheckGormTranContextExist 检查gorm是否存在

func FromGormContext

func FromGormContext(ctx context.Context) (db *gorm.DB, err error)

FromGormContext 从上下文中获取Gorm

func FromUserIDContext

func FromUserIDContext(ctx context.Context) (userID model.ID, err error)

FromUserIDContext ...

func NewGormContext

func NewGormContext(ctx context.Context, gdb *gorm.DB) context.Context

NewGormContext 创建Gorm上下文

func NewGormTranContext

func NewGormTranContext(ctx context.Context, gdb *gorm.DB) context.Context

NewGormTranContext 创建Gorm事务上下文

func NewUserIDContext

func NewUserIDContext(ctx context.Context, userID model.ID) context.Context

NewUserIDContext ...

func WithContext

func WithContext(ctx context.Context) context.Context

WithContext ...

func WithGinContext

func WithGinContext(ctx *gin.Context) context.Context

WithGinContext ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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