array

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 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](slice []T, chunkSize int) [][]T

Chunk 分组

func ChunkMap

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

ChunkMap Map分组

func Column

func Column[T any, N comparable, K comparable](input 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 Keys

func Keys[K comparable, V any](elements map[K]V) []K

Keys 获取Map的key

func KeysArray

func KeysArray[V comparable](elements []V, findValue V) []int

KeysArray 获取数组的key

func KeysFind

func KeysFind[K comparable, V comparable](elements map[K]V, findValue V) []K

KeysFind 获取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](elements 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