Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StructuredSorting ¶
type StructuredSorting struct{}
StructuredSorting 用于把结构化的排序指令转换为 GORM 的 order scope
func NewStructuredSorting ¶
func NewStructuredSorting() *StructuredSorting
NewStructuredSorting 创建实例
func (StructuredSorting) BuildScope ¶
func (ss StructuredSorting) BuildScope(orders []*paginationV1.Sorting) func(*gorm.DB) *gorm.DB
BuildScope 根据 orders 构建 GORM scope(可与 db.Scopes 一起使用)
func (StructuredSorting) BuildScopeWithDefaultField ¶
func (ss StructuredSorting) BuildScopeWithDefaultField(orders []*paginationV1.Sorting, defaultOrderField string, defaultDesc bool) func(*gorm.DB) *gorm.DB
BuildScopeWithDefaultField 当 orders 为空时使用默认排序字段 defaultOrderField 为空则不应用默认排序
Click to show internal directories.
Click to hide internal directories.