Documentation ¶
Index ¶
- Variables
- func Clone[M ~map[K]V, K comparable, V any](elements M) M
- func ConvertValues[M ~map[K]V, K comparable, V, Vto any](elements M, by c.Converter[V, Vto]) map[K]Vto
- func DeepClone[M ~map[K]V, K comparable, V any](elements M, valCopier func(V) V) M
- func For[M ~map[K]V, K comparable, V any](elements M, walker func(c.KV[K, V]) error) error
- func ForEach[M ~map[K]V, K comparable, V any](elements M, walker func(c.KV[K, V]))
- func ForEachKey[M ~map[K]V, K comparable, V any](elements M, walker func(K))
- func ForEachOrdered[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(c.KV[K, V]))
- func ForEachOrderedValues[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(V))
- func ForEachValue[M ~map[K]V, K comparable, V any](elements M, walker func(V))
- func ForKeys[M ~map[K]V, K comparable, V any](elements M, walker func(K) error) error
- func ForOrdered[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(c.KV[K, V]) error) error
- func ForOrderedValues[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(V) error) error
- func ForValues[M ~map[K]V, K comparable, V any](elements M, walker func(V) error) error
- func Generate[K comparable, V any](next func() (K, V, bool, error)) (map[K]V, error)
- func GenerateResolv[K comparable, V any](next func() (K, V, bool, error), resolv func(bool, K, V, V) V) (map[K]V, error)
- func GroupOfLoop[S any, K comparable, V any](source S, hasNext func(S) bool, getNext func(S) (K, V, error)) (map[K][]V, error)
- func Keys[M ~map[K]V, K comparable, V any](elements M) []K
- func OfLoop[S any, K comparable, V any](source S, hasNext func(S) bool, getNext func(S) (K, V, error)) (map[K]V, error)
- func OfLoopResolv[S any, K comparable, E, V any](source S, hasNext func(S) bool, getNext func(S) (K, E, error), ...) (map[K]V, error)
- func ToString[M ~map[K]V, K comparable, V any](elements M) string
- func ToStringOrdered[M ~map[K]V, K comparable, V any](order []K, elements M) string
- func ToStringOrderedf[M ~map[K]V, K comparable, V any](order []K, elements M, kvFormat, delim string) string
- func ToStringf[M ~map[K]V, K comparable, V any](elements M, kvFormat, delim string) string
- func Track[M ~map[K]V, K comparable, V any](elements M, tracker func(K, V) error) error
- func TrackEach[M ~map[K]V, K comparable, V any](elements M, tracker func(K, V))
- func TrackEachOrdered[M ~map[K]V, K comparable, V any](elements []K, uniques M, tracker func(K, V))
- func TrackOrdered[M ~map[K]V, K comparable, V any](order []K, uniques M, tracker func(K, V) error) error
- func Values[M ~map[K]V, K comparable, V any](elements M) []V
- func ValuesConverted[M ~map[K]V, K comparable, V, Vto any](elements M, by c.Converter[V, Vto]) []Vto
Constants ¶
This section is empty.
Variables ¶
var ErrBreak = it.ErrBreak
ErrBreak is For, Track breaker
Functions ¶
func Clone ¶ added in v0.0.5
func Clone[M ~map[K]V, K comparable, V any](elements M) M
Clone makes a copy of a map, copies the values as is
func ConvertValues ¶ added in v0.0.5
func ConvertValues[M ~map[K]V, K comparable, V, Vto any](elements M, by c.Converter[V, Vto]) map[K]Vto
ConvertValues creates a map with converted values
func DeepClone ¶ added in v0.0.5
func DeepClone[M ~map[K]V, K comparable, V any](elements M, valCopier func(V) V) M
DeepClone copies map values using a copier function to a new map and returns it
func For ¶
For applies a walker for every key/value pairs from a map. Key/value pair is boxed to the KV. To stop walking just return the ErrBreak
func ForEach ¶
func ForEach[M ~map[K]V, K comparable, V any](elements M, walker func(c.KV[K, V]))
ForEach applies a walker for every key/value pairs from a map. Key/value pair is boxed to the KV
func ForEachKey ¶
func ForEachKey[M ~map[K]V, K comparable, V any](elements M, walker func(K))
ForEachKey applies a walker for every key from a map
func ForEachOrdered ¶
func ForEachOrdered[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(c.KV[K, V]))
ForEachOrdered applies a walker for every key/value pairs from a map in order. Key/value pair is boxed to the KV
func ForEachOrderedValues ¶
func ForEachOrderedValues[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(V))
ForEachOrderedValues applies a walker for every value from a map in order
func ForEachValue ¶
func ForEachValue[M ~map[K]V, K comparable, V any](elements M, walker func(V))
ForEachValue applies a walker for every value from a map
func ForKeys ¶
func ForKeys[M ~map[K]V, K comparable, V any](elements M, walker func(K) error) error
ForKeys applies a walker for every key from a map. To stop walking just return the ErrBreak
func ForOrdered ¶
func ForOrdered[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(c.KV[K, V]) error) error
ForOrdered applies a walker for every key/value pairs from a map in order. Key/value pair is boxed to the KV. To stop walking just return the ErrBreak
func ForOrderedValues ¶
func ForOrderedValues[M ~map[K]V, K comparable, V any](elements []K, uniques M, walker func(V) error) error
ForOrderedValues applies a walker for every value from a map in order. To stop walking just return the ErrBreak
func ForValues ¶
func ForValues[M ~map[K]V, K comparable, V any](elements M, walker func(V) error) error
ForValues applies a walker for every value from a map. To stop walking just return the ErrBreak
func Generate ¶ added in v0.0.5
func Generate[K comparable, V any](next func() (K, V, bool, error)) (map[K]V, error)
Generate builds a map by an generator function. The next returns an key\value pair, or false if the generation is over, or an error.
func GenerateResolv ¶ added in v0.0.5
func GenerateResolv[K comparable, V any](next func() (K, V, bool, error), resolv func(bool, K, V, V) V) (map[K]V, error)
GenerateResolv builds a map by an generator function. The next returns an key\value pair, or false if the generation is over, or an error. The resolv selects value for duplicated keys.
func GroupOfLoop ¶ added in v0.0.5
func GroupOfLoop[S any, K comparable, V any](source S, hasNext func(S) bool, getNext func(S) (K, V, error)) (map[K][]V, error)
GroupOfLoop builds a map of slices by iterating over elements, extracting key\value pairs and grouping the values for each key in the slices. The hasNext specifies a predicate that tests existing of a next pair in the source. The getNext extracts the pair.
func Keys ¶
func Keys[M ~map[K]V, K comparable, V any](elements M) []K
Keys makes a slice of map keys
func OfLoop ¶ added in v0.0.5
func OfLoop[S any, K comparable, V any](source S, hasNext func(S) bool, getNext func(S) (K, V, error)) (map[K]V, error)
OfLoop builds a map by iterating key\value pairs of a source. The hasNext specifies a predicate that tests existing of a next pair in the source. The getNext extracts the pair.
func OfLoopResolv ¶ added in v0.0.5
func OfLoopResolv[S any, K comparable, E, V any](source S, hasNext func(S) bool, getNext func(S) (K, E, error), resolv func(bool, K, V, E) V) (map[K]V, error)
OfLoopResolv builds a map by iterating elements of a source. The hasNext specifies a predicate that tests existing of a next pair in the source. The getNext extracts the element. The resolv values for duplicated keys.
func ToString ¶
func ToString[M ~map[K]V, K comparable, V any](elements M) string
ToString converts elements to the string representation
func ToStringOrdered ¶
func ToStringOrdered[M ~map[K]V, K comparable, V any](order []K, elements M) string
ToStringOrdered converts elements to the string representation according to the order
func ToStringOrderedf ¶
func ToStringOrderedf[M ~map[K]V, K comparable, V any](order []K, elements M, kvFormat, delim string) string
ToStringOrderedf converts elements to a string representation using a key/value pair format and a delimeter. In order
func ToStringf ¶
func ToStringf[M ~map[K]V, K comparable, V any](elements M, kvFormat, delim string) string
ToStringf converts elements to a string representation using a key/value pair format and a delimeter
func Track ¶
func Track[M ~map[K]V, K comparable, V any](elements M, tracker func(K, V) error) error
Track applies a tracker for every key/value pairs from a map. To stop traking just return the ErrBreak
func TrackEach ¶
func TrackEach[M ~map[K]V, K comparable, V any](elements M, tracker func(K, V))
TrackEach applies a tracker for every key/value pairs from a map
func TrackEachOrdered ¶
func TrackEachOrdered[M ~map[K]V, K comparable, V any](elements []K, uniques M, tracker func(K, V))
TrackEachOrdered applies a tracker for every key/value pairs from a map in order
func TrackOrdered ¶
func TrackOrdered[M ~map[K]V, K comparable, V any](order []K, uniques M, tracker func(K, V) error) error
TrackOrdered applies a tracker for every key/value pairs from a map in order. To stop traking just return the ErrBreak
func Values ¶ added in v0.0.5
func Values[M ~map[K]V, K comparable, V any](elements M) []V
Values makes a slice of map values
func ValuesConverted ¶ added in v0.0.5
func ValuesConverted[M ~map[K]V, K comparable, V, Vto any](elements M, by c.Converter[V, Vto]) []Vto
ValuesConverted makes a slice of converted map values
Types ¶
This section is empty.