stl

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllMatch

func AllMatch[Data any](datas []Data, test func(Data) bool) bool

func AllMatchPro added in v1.0.3

func AllMatchPro[Data any, Datas ~[]Data](datas Datas, test func(int, Data, Datas) bool) bool

func AnyMatch

func AnyMatch[Data any](datas []Data, test func(Data) bool) bool

func AnyMatchPro added in v1.0.3

func AnyMatchPro[Data any, Datas ~[]Data](datas Datas, test func(int, Data, Datas) bool) bool

func BatchDeleteMap

func BatchDeleteMap[Key comparable, Keys ~[]Key, Value any, Map ~map[Key]Value](m Map, keys Keys) Map

func BatchDeleteMapFromAnother

func BatchDeleteMapFromAnother[Key comparable, Value any, Map ~map[Key]Value](m Map, keys Map) Map

func CacheMapValue added in v1.0.8

func CacheMapValue[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key, value Value) Value

func CacheMapValueWithInitializer added in v1.0.8

func CacheMapValueWithInitializer[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key, initializer func() Value) Value

func Compare added in v1.0.8

func Compare[Data constraints.Ordered](as []Data, bs []Data) int

func ConcatMap

func ConcatMap[Key comparable, Value any, Map ~map[Key]Value](m1, m2 Map) Map

func ConcatMapInplace

func ConcatMapInplace[Key comparable, Value any, Map ~map[Key]Value](m1, m2 Map) Map

func ConcatSlices

func ConcatSlices[Data any, Slice ~[]Data](slices ...Slice) Slice

func ConcatSlicesTo

func ConcatSlicesTo[Data any, Slice ~[]Data](slice Slice, slices ...Slice) Slice

func Dup added in v1.0.7

func Dup[Data any, Ptr ~*Data](ptr Ptr) Ptr

func DupMap

func DupMap[Key comparable, Value any, Map ~map[Key]Value](m Map) Map

func DupSlice

func DupSlice[Data any, Slice ~[]Data](slice Slice) Slice

func EqualBySet added in v1.0.8

func EqualBySet[Data comparable](as []Data, bs []Data) bool

func EqualBySort added in v1.0.8

func EqualBySort[Data constraints.Ordered](as []Data, bs []Data) bool

func FillSliceToCap added in v1.0.8

func FillSliceToCap[Data any, Datas ~[]Data](datas Datas, g func(int) Data) Datas

func Filter

func Filter[Data any, Datas ~[]Data](datas Datas, filter func(Data) bool) Datas

func FilterPro added in v1.0.3

func FilterPro[Data any, Datas ~[]Data](datas Datas, filter func(int, Data, Datas) bool) Datas

func Find

func Find[Data any](datas []Data, test func(Data) bool) (Data, bool)

func ForEach

func ForEach[Data any](datas []Data, handler func(data Data))

func ForEachPro added in v1.0.3

func ForEachPro[Data any, Datas ~[]Data](datas Datas, handler func(i int, data Data, datas Datas))

func GetSliceElemPointers

func GetSliceElemPointers[Data any, Datas ~[]Data](datas Datas) []*Data

func IndexOf

func IndexOf[Data comparable](datas []Data, target Data) int

func InstancesToPointers

func InstancesToPointers[Data any, Instances ~[]Data](instances Instances) []*Data

func Map

func Map[Data any, Datas ~[]Data, Result any](datas Datas, mapper func(Data) Result) []Result

func MapAndConcat

func MapAndConcat[Data any, Datas ~[]Data, Result any, Results ~[]Result](datas Datas, mapper func(Data) Results) Results

func MapArgs

func MapArgs[Data any, Result any](mapper func(Data) Result, args ...Data) []Result

func MapKeys

func MapKeys[Key comparable, Value any, Map ~map[Key]Value](m Map) []Key

func MapPro added in v1.0.3

func MapPro[Data any, Datas ~[]Data, Result any](datas Datas, mapper func(int, Data, Datas) Result) []Result

func MapProArgs added in v1.0.3

func MapProArgs[Data any, Datas ~[]Data, Result any](mapper func(int, Data, Datas) Result, datas ...Data) []Result

func MapValues added in v1.0.6

func MapValues[Key comparable, Value any, Map ~map[Key]Value](m Map) []Value

func MapValuesByKeys added in v1.0.6

func MapValuesByKeys[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) []Value

func MappingByKey

func MappingByKey[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(Data) Key) map[Key]Data

func MappingByKeyPro added in v1.0.3

func MappingByKeyPro[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(int, Data, Datas) Key) map[Key]Data

func MappingByKeys

func MappingByKeys[Data any, Datas ~[]Data, Key comparable, Keys ~[]Key](datas Datas, keys func(Data) Keys) map[Key]Data

func PopMap

func PopMap[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key) (value Value, ok bool)

func Purge

func Purge[Data any, Datas ~[]Data](datas Datas, filter func(Data) bool) Datas

func PurgeValue

func PurgeValue[Data comparable, Datas ~[]Data](datas Datas, value Data) Datas

func PurgeZero

func PurgeZero[Data comparable, Datas ~[]Data](datas Datas) Datas

func ReadChan added in v1.0.8

func ReadChan[Data any](c chan Data, n int) []Data

func ReadChanAll added in v1.0.8

func ReadChanAll[Data any, Datas ~[]Data](c chan Data) (datas Datas)

func Reduce

func Reduce[Data any, Datas ~[]Data, Result any](datas Datas, reducer func(Data, Result) Result, initial Result) (result Result)

func ReducePro added in v1.0.3

func ReducePro[Data any, Datas ~[]Data, Result any](datas Datas, reducer func(int, Data, Datas, Result) Result, initial Result) (result Result)

func SliceEqual added in v1.0.11

func SliceEqual[Datas ~[]Data, Data comparable](as Datas, bs Datas) bool

func SliceMappingByKey

func SliceMappingByKey[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(Data) Key) map[Key]Datas

func SliceMappingByKeys

func SliceMappingByKeys[Data any, Datas ~[]Data, Key comparable, Keys ~[]Key](datas Datas, keys func(Data) Keys) map[Key]Datas

func Sort

func Sort[Data any, Datas ~[]Data](datas Datas, less func(a, b Data) bool) Datas

func SortFast

func SortFast[Data constraints.Ordered, Datas ~[]Data](datas Datas) Datas

func SortUniqueFast

func SortUniqueFast[Data constraints.Ordered, Datas ~[]Data](datas Datas) Datas

func Unique

func Unique[Data comparable, Datas ~[]Data](datas Datas, equal func(Data, Data) bool) Datas

func UniqueByKeySet added in v1.0.11

func UniqueByKeySet[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas

func UniqueBySet

func UniqueBySet[Data comparable, Datas ~[]Data](datas Datas) Datas

func UniqueSorteds added in v1.0.11

func UniqueSorteds[Data comparable, Datas ~[]Data](datas Datas) Datas

Types

type ComparableSlice added in v1.0.8

type ComparableSlice[Data comparable] []Data

func NewComparableSlice added in v1.0.8

func NewComparableSlice[Data comparable](datas ...Data) ComparableSlice[Data]

func (ComparableSlice[Data]) AllMatch added in v1.0.8

func (slice ComparableSlice[Data]) AllMatch(f func(Data) bool) bool

func (ComparableSlice[Data]) AnyMatch added in v1.0.8

func (slice ComparableSlice[Data]) AnyMatch(f func(Data) bool) bool

func (ComparableSlice[Data]) Contain added in v1.0.11

func (slice ComparableSlice[Data]) Contain(data Data) bool

func (ComparableSlice[Data]) ContainAll added in v1.0.11

func (slice ComparableSlice[Data]) ContainAll(datas ...Data) bool

func (ComparableSlice[Data]) ContainAny added in v1.0.11

func (slice ComparableSlice[Data]) ContainAny(datas ...Data) bool

func (ComparableSlice[Data]) Dup added in v1.0.8

func (slice ComparableSlice[Data]) Dup() ComparableSlice[Data]

func (ComparableSlice[Data]) Filter added in v1.0.8

func (slice ComparableSlice[Data]) Filter(f func(Data) bool) ComparableSlice[Data]

func (ComparableSlice[Data]) ForEachPro added in v1.0.8

func (slice ComparableSlice[Data]) ForEachPro(f func(int, Data, ComparableSlice[Data]))

func (ComparableSlice[Data]) Map added in v1.0.8

func (slice ComparableSlice[Data]) Map(f func(Data) Data) Slice[Data]

func (ComparableSlice[Data]) Native added in v1.0.8

func (slice ComparableSlice[Data]) Native() []Data

func (ComparableSlice[Data]) NotNilSlice added in v1.0.8

func (slice ComparableSlice[Data]) NotNilSlice() ComparableSlice[Data]

type Set

type Set[Data comparable] map[Data]struct{}

func NewEmptySet

func NewEmptySet[Data comparable]() Set[Data]

func NewSet

func NewSet[Data comparable](datas ...Data) Set[Data]

func (Set[Data]) Add

func (set Set[Data]) Add(data Data) Set[Data]

func (Set[Data]) AddX added in v1.0.11

func (set Set[Data]) AddX(datas ...Data) Set[Data]

func (Set[Data]) Contain

func (set Set[Data]) Contain(data Data) bool

func (Set[Data]) Difference

func (set Set[Data]) Difference(other Set[Data]) Set[Data]

func (Set[Data]) Dup

func (set Set[Data]) Dup() Set[Data]

func (Set[Data]) Empty

func (set Set[Data]) Empty() bool

func (Set[Data]) Equal

func (set Set[Data]) Equal(other Set[Data]) bool

func (Set[Data]) FirstAppear added in v1.0.8

func (set Set[Data]) FirstAppear(datas ...Data) (result Data)

func (Set[Data]) Intersection

func (set Set[Data]) Intersection(other Set[Data]) Set[Data]

func (Set[Data]) Len

func (set Set[Data]) Len() int

func (Set[Data]) Merge added in v1.0.11

func (set Set[Data]) Merge(other Set[Data]) Set[Data]

func (Set[Data]) Pop

func (set Set[Data]) Pop(data Data) Set[Data]

func (Set[Data]) Purge added in v1.0.11

func (set Set[Data]) Purge(other Set[Data]) Set[Data]

func (Set[Data]) Push

func (set Set[Data]) Push(data Data) Set[Data]

func (Set[Data]) PushX

func (set Set[Data]) PushX(datas ...Data) Set[Data]

func (Set[Data]) Slice

func (set Set[Data]) Slice() Slice[Data]

func (Set[Data]) SymmetricDifference

func (set Set[Data]) SymmetricDifference(other Set[Data]) Set[Data]

func (Set[Data]) Union

func (set Set[Data]) Union(other Set[Data]) Set[Data]

type Slice added in v1.0.8

type Slice[Data any] []Data

func NewSlice added in v1.0.6

func NewSlice[Data any](datas ...Data) Slice[Data]

func (Slice[Data]) AllMatch added in v1.0.8

func (slice Slice[Data]) AllMatch(f func(Data) bool) bool

func (Slice[Data]) AnyMatch added in v1.0.8

func (slice Slice[Data]) AnyMatch(f func(Data) bool) bool

func (Slice[Data]) Dup added in v1.0.8

func (slice Slice[Data]) Dup() Slice[Data]

func (Slice[Data]) Filter added in v1.0.8

func (slice Slice[Data]) Filter(f func(Data) bool) Slice[Data]

func (Slice[Data]) FilterPro added in v1.0.14

func (slice Slice[Data]) FilterPro(f func(int, Data, Slice[Data]) bool) Slice[Data]

func (Slice[Data]) ForEach added in v1.0.14

func (slice Slice[Data]) ForEach(f func(Data))

func (Slice[Data]) ForEachPro added in v1.0.8

func (slice Slice[Data]) ForEachPro(f func(int, Data, Slice[Data]))

func (Slice[Data]) Map added in v1.0.8

func (slice Slice[Data]) Map(f func(Data) Data) Slice[Data]

func (Slice[Data]) MapPro added in v1.0.14

func (slice Slice[Data]) MapPro(f func(int, Data, Slice[Data]) Data) Slice[Data]

func (Slice[Data]) Native added in v1.0.8

func (slice Slice[Data]) Native() []Data

func (Slice[Data]) NotNilSlice added in v1.0.8

func (slice Slice[Data]) NotNilSlice() Slice[Data]

Jump to

Keyboard shortcuts

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