Documentation ¶
Index ¶
- Constants
- func GetTx(ctx context.Context, db *gorm.DB) *gorm.DB
- func WithTx(ctx context.Context, tx *gorm.DB) context.Context
- type Field
- type ScopeMethod
- func BetweenColumn(column Field, min, max any) ScopeMethod
- func CreatedAtDesc() ScopeMethod
- func DeleteAtGT0() ScopeMethod
- func DeletedAtDesc() ScopeMethod
- func IdGT(id uint32) ScopeMethod
- func InIds(ids ...uint32) ScopeMethod
- func NameEQ(name string) ScopeMethod
- func NameIn(names ...string) ScopeMethod
- func NameLike(name string) ScopeMethod
- func NotInIds(ids ...uint32) ScopeMethod
- func StatusEQ(status vobj.Status) ScopeMethod
- func StatusNotEQ(status vobj.Status) ScopeMethod
- func TitleLike(title string) ScopeMethod
- func UpdateAtDesc() ScopeMethod
- func WhereInColumn[T any](column Field, values ...T) ScopeMethod
- func WhereLikeKeyword(keyword string, columns ...Field) ScopeMethod
- func WhereLikePrefixKeyword(keyword string, columns ...Field) ScopeMethod
- func WhereLikeSuffixKeyword(keyword string, columns ...Field) ScopeMethod
- func WithCreateBy(ctx context.Context) ScopeMethod
- func WithTrashed(isDelete bool) ScopeMethod
- func WithUserId(ctx context.Context) ScopeMethod
- type TxContext
Constants ¶
View Source
const ( DESC = "DESC" ASC = "ASC" LIKE = "LIKE" BETWEEN = "BETWEEN" AND = "AND" OR = "OR" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Field ¶
type Field string
const ( BaseFieldID Field = "id" BaseFieldCreatedAt Field = "created_at" BaseFieldUpdatedAt Field = "updated_at" BaseFieldDeletedAt Field = "deleted_at" BaseFieldStatus Field = "status" BaseFieldName Field = "name" BaseFieldRemark Field = "remark" BaseFieldCreateBy Field = "create_by" BaseFieldTitle Field = "title" BaseFieldUserId Field = "user_id" )
type ScopeMethod ¶
func BetweenColumn ¶
func BetweenColumn(column Field, min, max any) ScopeMethod
BetweenColumn 通过字段名和值列表进行查询
func WhereInColumn ¶
func WhereInColumn[T any](column Field, values ...T) ScopeMethod
WhereInColumn 通过字段名和值列表进行查询
func WhereLikeKeyword ¶
func WhereLikeKeyword(keyword string, columns ...Field) ScopeMethod
WhereLikeKeyword 前后缀模糊查询
func WhereLikePrefixKeyword ¶
func WhereLikePrefixKeyword(keyword string, columns ...Field) ScopeMethod
WhereLikePrefixKeyword 前缀模糊查询
func WhereLikeSuffixKeyword ¶
func WhereLikeSuffixKeyword(keyword string, columns ...Field) ScopeMethod
WhereLikeSuffixKeyword 后缀模糊查询
Click to show internal directories.
Click to hide internal directories.