array

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk

func Chunk[T any](array []T, chunkSize int) [][]T

Chunk 分组

func ChunkMap

func ChunkMap[K comparable, V any](array map[K]V, chunkSize int) []map[K]V

ChunkMap Map分组

func Column

func Column[T any, N comparable, K comparable](array map[N]map[K]T, columnKey K) []T

Column 获取Map指定column

func Diff

func Diff[T comparable](a []T, b ...[]T) []T

Diff 获取切片a中不存在于b的元素

func In

func In[T comparable](array []T, find T) bool

In 是否存在

func Intersect added in v1.0.14

func Intersect[T comparable](a, b []T) []T

Intersect 获取切片a、b的交集

func Keys

func Keys[V comparable](array []V, find V) []int

Keys 获取切片的key

func KeysFind

func KeysFind[K comparable, V comparable](array map[K]V, find V) []K

KeysFind 获取Map指定值的key

func KeysMap added in v1.0.13

func KeysMap[K comparable, V any](array map[K]V) []K

KeysMap 获取Map的key

func NotIn

func NotIn[T comparable](array []T, find T) bool

NotIn 是否不存在

func ToLower

func ToLower(array []string) []string

ToLower 转小写

func ToUpper

func ToUpper(array []string) []string

ToUpper 转大写

func Values

func Values[K comparable, V any](array map[K]V) []V

Values 获取Map的value

Types

type CombineNum

type CombineNum struct {
	Length int    //长度
	Sep    string //分割符号
}

func (*CombineNum) Get

func (c *CombineNum) Get(text string, id int) (int, error)

func (*CombineNum) Parse

func (c *CombineNum) Parse(text string) []string

func (*CombineNum) Set

func (c *CombineNum) Set(text string, id int, num int) (string, error)

type SliceWithMutex added in v1.0.1

type SliceWithMutex[T any] struct {
	// contains filtered or unexported fields
}

func (*SliceWithMutex[T]) Add added in v1.0.1

func (s *SliceWithMutex[T]) Add(value T)

func (*SliceWithMutex[T]) All added in v1.0.1

func (s *SliceWithMutex[T]) All() []T

func (*SliceWithMutex[T]) Get added in v1.0.1

func (s *SliceWithMutex[T]) Get(index int) T

func (*SliceWithMutex[T]) Len added in v1.0.1

func (s *SliceWithMutex[T]) Len() int

func (*SliceWithMutex[T]) Pop added in v1.0.1

func (s *SliceWithMutex[T]) Pop() []T

type Sort

type Sort []interface{}

Sort 按照 Id 进行排序

func (Sort) Len

func (a Sort) Len() int

func (Sort) Less

func (a Sort) Less(i, j int) bool

func (Sort) Swap

func (a Sort) Swap(i, j int)

Jump to

Keyboard shortcuts

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