Documentation
¶
Index ¶
- func IsIn[T comparable, S1 ~[]T, S2 ~[]T](s S1, list S2) int
- func IsNotIn[T comparable, S1 ~[]T, S2 ~[]T](s S1, list S2) int
- func IsUnique[T comparable, S ~[]T](s S) int
- func IsUniqueBy[T any, U comparable, S ~[]T](s S, keyFn func(T) U) int
- func ToMap[T comparable, S ~[]T](s S) map[T]struct{}
- type ErrorParam
- type Float
- type Int
- type Number
- type String
- type Time
- type UInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIn ¶
func IsIn[T comparable, S1 ~[]T, S2 ~[]T](s S1, list S2) int
IsIn returns -1 if every item of a slice is in another slice. Returns index of the first item if it is not in the target slice.
func IsNotIn ¶
func IsNotIn[T comparable, S1 ~[]T, S2 ~[]T](s S1, list S2) int
IsNotIn returns -1 if any item of a slice is not in another slice. Returns index of the first item if it is in the target slice.
func IsUnique ¶
func IsUnique[T comparable, S ~[]T](s S) int
IsUnique returns -1 if every item of a slice is unique. Returns index of the first item if it is a duplication of another.
func IsUniqueBy ¶ added in v1.1.0
func IsUniqueBy[T any, U comparable, S ~[]T](s S, keyFn func(T) U) int
IsUniqueBy returns -1 if every value returned by the key function is unique. Returns index of the first item if it is a duplication of another.
func ToMap ¶
func ToMap[T comparable, S ~[]T](s S) map[T]struct{}
ToMap transforms a slice to a map with slice items as map keys
Types ¶
type ErrorParam ¶
ErrorParam data structure for an error param
Click to show internal directories.
Click to hide internal directories.