Documentation ¶
Index ¶
- func ChunkBy[T any](items []T, chunkSize int) (chunks [][]T)
- func Contains[T comparable](collection []T, element T) bool
- func CopyMap[K, V comparable](m map[K]V) map[K]V
- func Filter[T any](collection []T, f func(e T, i int) bool) []T
- func Keys[M ~map[K]V, K comparable, V any](m M) []K
- func Map[T, U any](ts []T, f func(e T, i int) U) []U
- func MergeMaps[M ~map[K]V, K comparable, V any](src ...M) M
- func OmitByKeys[K comparable, V any](in map[K]V, keys []K) map[K]V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](collection []T, element T) bool
Contains checks if the given element is present in the collection.
func CopyMap ¶
func CopyMap[K, V comparable](m map[K]V) map[K]V
CopyMap creates a new copy of the given map and returns it.
func Keys ¶
func Keys[M ~map[K]V, K comparable, V any](m M) []K
Keys returns the keys of the map m. The keys will be an indeterminate order.
func MergeMaps ¶
func MergeMaps[M ~map[K]V, K comparable, V any](src ...M) M
MergeMaps merges multiple maps into a single map and returns the merged result.
func OmitByKeys ¶
func OmitByKeys[K comparable, V any](in map[K]V, keys []K) map[K]V
OmitByKeys creates a new map by omitting key-value pairs from the input map based on the specified keys.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.