Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffSlice ¶
func DiffSlice[T comparable](old, new []T) (add, remove []T)
DiffSlice 比较两个切片的差异 old: 旧切片数据 new: 新切片数据 返回:
- add: 在 new 中存在但 old 中不存在的元素(新增)
- remove: 在 old 中存在但 new 中不存在的元素(删除)
注意:T 必须是 comparable 类型
func FilterSlice ¶
FilterSlice 过滤切片中的元素 array: 待过滤的源切片 fn: 过滤函数,接收索引和元素值,返回 true 表示保留,false 表示丢弃 返回: 包含所有保留元素的新切片
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.