Documentation ¶
Index ¶
- Variables
- func CheckGormTranContextExist(ctx context.Context) bool
- func FromGormContext(ctx context.Context) (db *gorm.DB, err error)
- func FromUserIDContext(ctx context.Context) (userID model.ID, err error)
- func NewGormContext(ctx context.Context, gdb *gorm.DB) context.Context
- func NewGormTranContext(ctx context.Context, gdb *gorm.DB) context.Context
- func NewUserIDContext(ctx context.Context, userID model.ID) context.Context
- func WithContext(ctx context.Context) context.Context
- func WithGinContext(ctx *gin.Context) context.Context
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 ¶
CheckGormTranContextExist 检查gorm是否存在
func FromGormContext ¶
FromGormContext 从上下文中获取Gorm
func FromUserIDContext ¶
FromUserIDContext ...
func NewGormContext ¶
NewGormContext 创建Gorm上下文
func NewGormTranContext ¶
NewGormTranContext 创建Gorm事务上下文
func NewUserIDContext ¶
NewUserIDContext ...
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.