sortutil

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MoveItem

func MoveItem[T any](id int64, direction string, items []T,
	getID func(T) int64, getOrder func(T) int, updateOrder func(int64, int) error,
) error

MoveItem 通用排序移动逻辑(up/down/top)

func ReorderSiblings added in v1.6.0

func ReorderSiblings[T any](siblings []T, movedID, beforeID int64, getID func(T) int64) []T

ReorderSiblings 把 movedID 从 siblings 中抽出,插到 beforeID 之前; beforeID == 0 或未在 siblings 中找到时,追加到末尾。 返回重排后的切片;若 movedID 未在 siblings 中找到,原样返回。

Types

This section is empty.

Jump to

Keyboard shortcuts

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