Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultIndexGap 默认稀疏索引间隔
DefaultIndexGap = 1000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReorderPlan ¶
type ReorderPlan struct {
// Unchanged 是否未发生位置变化(原地拖拽,无需写库)
Unchanged bool
// NeedRebalance 是否需要全局重平衡
NeedRebalance bool
// NewSortKey 单条更新时的目标 SortKey(快速路径)
NewSortKey int64
// Items 批量重平衡更新项列表(慢路径)
Items []Item
}
ReorderPlan 重排计算方案
func Reorder ¶ added in v1.11.3
func Reorder[E Sortable](elements []E, draggedID, targetPosition int64) ReorderPlan
Reorder 使用默认步长计算重排方案
func ReorderWithGap ¶ added in v1.11.3
func ReorderWithGap[E Sortable](elements []E, draggedID, targetPosition, gap int64) ReorderPlan
ReorderWithGap 自定义稀疏步长计算重排方案
Click to show internal directories.
Click to hide internal directories.