sliceHelper

package
v1.5.78 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayFilter

func ArrayFilter(a []interface{}) (ret []interface{})

*

  • @func: ArrayFilter 不知道
  • @author Wiidz
  • @date 2019-11-06

func ArrayGroupByMapKey

func ArrayGroupByMapKey(key string, list []map[string]interface{}) [][]map[string]interface{}

*

  • @func: ArrayGroupByMapKey 以一个数组map 中的某一个key 进行分组
  • @author Wiidz
  • @date 2019-11-16

func Difference added in v1.5.6

func Difference(s1, s2 []interface{}) []interface{}

Difference 获取s1比s2差异的部分

func DifferenceUint64 added in v1.5.6

func DifferenceUint64(s1, s2 []uint64) []uint64

DifferenceUint64 获取s1比s2差异的部分

func Exist

func Exist(needle interface{}, scopeSlice interface{}) bool

Exist 判断slice中是否存在needle

func ExistInt added in v1.5.6

func ExistInt(needle int, scopeSlice []int) bool

*

  • @func: Exsit 判断slice中是否存在needle
  • @author Wiidz
  • @date 2019-11-16

func ExistUint64 added in v1.5.6

func ExistUint64(needle uint64, scopeSlice []uint64) bool

*

  • @func: Exsit 判断slice中是否存在needle
  • @author Wiidz
  • @date 2019-11-16

func Float64SliceDelete

func Float64SliceDelete(slice []float64, index int) []float64

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func Float64SliceSum

func Float64SliceSum(arr []float64) float64

*

  • @func: Float64SliceSum float64切片求和
  • @author Wiidz
  • @date 2019-11-06

func GetFloat64FromInt64MapSlice

func GetFloat64FromInt64MapSlice(d []map[string]interface{}, column_key string) []float64

*

  • @func: SkuList 从map slice中获取键值 int64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetFloat64FromInterfaceSlice

func GetFloat64FromInterfaceSlice(d []interface{}, column_key string) []float64

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetFloat64FromMapSlice

func GetFloat64FromMapSlice(d []map[string]interface{}, column_key string) []float64

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetInt64FromInterfaceSlice

func GetInt64FromInterfaceSlice(d []interface{}, column_key string) []int64

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetInt64FromMapSlice

func GetInt64FromMapSlice(d []map[string]interface{}, column_key string) []int64

*

  • @func: SkuList 从map slice中获取键值 int64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetIntFromInterfaceSlice

func GetIntFromInterfaceSlice(d []interface{}, column_key string) []int

*

  • @func: GetFloat64FromMapSlice 从map slice中获取键值float64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetIntFromMapSlice

func GetIntFromMapSlice(d []map[string]interface{}, column_key string) []int

*

  • @func: GetIntFromMapSlice 从map slice中获取键值 int slice
  • @author Wiidz
  • @date 2019-11-06

func GetIntFromMapSliceByInt64

func GetIntFromMapSliceByInt64(d []map[string]interface{}, column_key string) []int

*

  • @func: SkuList 从map slice中获取键值 int64 slice
  • @author Wiidz
  • @date 2019-11-06

func GetParentIds

func GetParentIds(children_id, result_str, key string, original_data []map[string]interface{}) string

*

  • @func: GetParentIds 递归查找父级逗号隔开从高到低
  • @author Wiidz
  • @date 2019-11-16

func GetRange

func GetRange(min float64, max float64, step float64) []float64

*

  • @func: GetRange 类似php的函数,获取范围内的整数集合
  • @author Wiidz
  • @date 2019-11-06

func GetValuesFromInterfaceSlice

func GetValuesFromInterfaceSlice(d []interface{}, column_key string) []interface{}

*

  • @func: GetValuesFromInterface 从interface slice中获取键值slice
  • @author Wiidz
  • @date 2019-11-06

func GetValuesFromMapSlice

func GetValuesFromMapSlice(d []map[string]interface{}, column_key string) []interface{}

*

  • @func: GetValuesFromMapSlice 从map slice中获取键值slice
  • @author Wiidz
  • @date 2019-11-06

func IndexOf

func IndexOf(needle interface{}, scopeSlice []interface{}) int

IndexOf 从slice中,寻找指定内容的键值

func IndexOfOld added in v1.5.6

func IndexOfOld(needle interface{}, scopeSlice interface{}) int

*

  • @func: IndexOfOld 从slice中,寻找指定内容的键值
  • @author Wiidz
  • @date 2019-11-06

func IndexOfStrSlice

func IndexOfStrSlice(needle string, fields_slice []string) int

*

  • @func: IndexOfStrSlice 从str slice中,寻找指定内容的键值
  • @author Wiidz
  • @date 2019-11-06

func Int64Slice2Float64Slice

func Int64Slice2Float64Slice(data []int64) []float64

func Int64SliceDelete

func Int64SliceDelete(slice []int64, index int) []int64

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func IntSliceDelete

func IntSliceDelete(slice []int, index int) []int

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func InterfaceSlice2SimpleMap

func InterfaceSlice2SimpleMap(data []interface{}, index, key string) map[string]interface{}

func InterfaceSliceSum

func InterfaceSliceSum(arr []interface{}) float64

*

  • @func: InterfaceSliceSum float64切片求和
  • @author Wiidz
  • @date 2019-11-06

func Intersect

func Intersect(arr_1 []interface{}, arr_2 []interface{}) []interface{}

*

  • @func: ArrayIntersect 取出两个slice的交集
  • @author Wiidz
  • @date 2019-11-06

func Intersection added in v1.5.6

func Intersection(s1, s2 []interface{}) []interface{}

Intersection 获取s1和s2的交集

func IsElementEqual added in v1.5.6

func IsElementEqual(requiredIDs, paramsIDs []uint64) bool

IsElementEqual 判断参数的attrIDs是否和数据库里的要求吻合

func Join

func Join(islice []string, letter string) string

func JoinInterfaceSlice

func JoinInterfaceSlice(islice []interface{}, letter string) string

func MapSlice2SimpleMap

func MapSlice2SimpleMap(data []map[string]interface{}, index, key string) map[string]interface{}

func MapSliceDelete

func MapSliceDelete(slice []map[string]interface{}, index int) []map[string]interface{}

*

  • @func: StrSliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func MapSliceReverse

func MapSliceReverse(arr []map[string]interface{}) ([]map[string]interface{}, error)

*

  • @func: MapSliceReverse 将map slice倒过来排
  • @author Wiidz
  • @date 2019-11-16

func NarrowSlice

func NarrowSlice(arr []map[string]interface{}, amount int) []map[string]interface{}

*

  • @func: NarrowSlice 缩短slice,取中间部分
  • @author Wiidz
  • @date 2019-11-06

func Paginator

func Paginator(page, pageSize int, data []map[string]interface{}) []map[string]interface{}

*

  • @func: Paginator 组装分页
  • @author Wiidz
  • @date 2019-11-16

func Slice2MapByInt64ColumnAsKey

func Slice2MapByInt64ColumnAsKey(data []map[string]interface{}, index string) map[string]interface{}

func SliceDelete

func SliceDelete(slice []interface{}, index int) []interface{}

*

  • @func: SliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func StrSliceDelete

func StrSliceDelete(slice []string, index int) []string

*

  • @func: StrSliceDelete 返回新slice(不包含指定的那个index键)
  • @author Wiidz
  • @date 2019-11-06

func Union added in v1.5.6

func Union(s1, s2 []interface{}) []interface{}

Union 获取s1和s2的并集

func UniqueByLoop

func UniqueByLoop(slc []int) []int

UniqueByLoop 通过两重循环过滤重复元素

func UniqueByLoopInt8 added in v1.5.6

func UniqueByLoopInt8(slc []int8) []int8

func UniqueByLoopUint64 added in v1.5.6

func UniqueByLoopUint64(slc []uint64) []uint64

UniqueByLoopUint64 通过两重循环过滤重复元素

func UniqueByMap

func UniqueByMap(slc []int) []int

*

  • @func: UniqueByMap 通过map主键唯一的特性过滤重复元素
  • @author Wiidz
  • @date 2019-11-16

func UniqueByMapUint64 added in v1.5.6

func UniqueByMapUint64(slc []uint64) []uint64

*

  • @func: UniqueByMap 通过map主键唯一的特性过滤重复元素
  • @author Wiidz
  • @date 2019-11-16

func UniqueInt8Slice added in v1.5.6

func UniqueInt8Slice(slc []int8) []int8

UniqueInt8Slice int8 slice去重

func UniqueIntSlice

func UniqueIntSlice(slc []int) []int

*

  • @func: UniqueIntSlice int slice去重
  • @author Wiidz
  • @date 2019-11-06

func UniqueInterface

func UniqueInterface(slc []interface{}) []interface{}

*

  • @func: UniqueInterface interface slice去重
  • @author Wiidz
  • @date 2019-11-06

func UniqueMapByFloat64Key added in v1.5.6

func UniqueMapByFloat64Key(sourceSlice []map[string]interface{}, keyName string) []map[string]interface{}

UniqueMapByFloat64Key 根据某一个float64键来去重

func UniqueMapByInt64Key added in v1.5.6

func UniqueMapByInt64Key(sourceSlice []map[string]interface{}, keyName string) []map[string]interface{}

UniqueMapByInt64Key 根据某一个int64键来去重

func UniqueMapByIntKey added in v1.5.6

func UniqueMapByIntKey(sourceSlice []map[string]interface{}, keyName string) []map[string]interface{}

UniqueMapByIntKey 根据某一个int键来去重

func UniqueMapByStrKey added in v1.5.6

func UniqueMapByStrKey(sourceSlice []map[string]interface{}, keyName string) []map[string]interface{}

UniqueMapByStrKey 根据某一个str键来去重

func UniqueMapByUint64Key added in v1.5.6

func UniqueMapByUint64Key(sourceSlice []map[string]interface{}, keyName string) []map[string]interface{}

UniqueMapByUint64Key 根据某一个uint64键来去重

func UniqueStrSlice

func UniqueStrSlice(strSlice []string) []string

*

  • @func: UniqueStrSlice str slice去重
  • @author Wiidz
  • @date 2019-11-16

func UniqueUint64Slice added in v1.5.6

func UniqueUint64Slice(slc []uint64) []uint64

UniqueUint64Slice int slice去重

Types

This section is empty.

Jump to

Keyboard shortcuts

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