sorting

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 5 Imported by: 0

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 为空则不应用默认排序

Jump to

Keyboard shortcuts

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