sort

package
v0.0.0-...-1b159e1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package sort 提供基于枚举类型的排序选项 By,可生成排序方向(正序/逆序)的可枚举列表, 适用于 API 参数绑定、排序 UI 选项生成等场景。

By 本身实现了 enumeration.CanEnumValues,配合 enumeration 生态可直接作为枚举值使用。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type By

type By[E enumeration.CanEnumValues] struct {
	Field E
	Order Order
	// contains filtered or unexported fields
}

func (By[E]) EnumValues

func (s By[E]) EnumValues() (values []any)

func (*By[E]) IsZero

func (a *By[E]) IsZero() bool

func (By[E]) MarshalText

func (v By[E]) MarshalText() ([]byte, error)

func (*By[E]) UnmarshalText

func (v *By[E]) UnmarshalText(data []byte) error

type Order

type Order string
const (
	Asc  Order = "asc"
	Desc Order = "desc"
)

Jump to

Keyboard shortcuts

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