Documentation ¶
Overview ¶
Package generic contains generic functions that can be used by any other package.
Index ¶
- func ContainSlice[T comparable](s []T, v T) bool
- func CopySlice[T any](s []T) []T
- func HashSlice[K comparable, T any](s []T, fn func(T) K) map[K]T
- func IndexSlice[T comparable](s []T, v T) int
- func MapKeys[K comparable, V any](m map[K]V) []K
- func MapSlice[T, V any](s []T, fn func(T) V) []V
- func Must[T any](v T, err error) T
- func Ptr[T any](v T) *T
- func Reverse[T any](s []T)
- func SortMapKeys[K cmp.Ordered, V any](m map[K]V) []K
- func Try[T any](v T, err error) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainSlice ¶ added in v1.0.3
func ContainSlice[T comparable](s []T, v T) bool
func HashSlice ¶ added in v1.0.2
func HashSlice[K comparable, T any](s []T, fn func(T) K) map[K]T
func IndexSlice ¶ added in v1.0.3
func IndexSlice[T comparable](s []T, v T) int
func MapKeys ¶ added in v1.0.2
func MapKeys[K comparable, V any](m map[K]V) []K
func SortMapKeys ¶ added in v1.0.2
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.