Documentation ¶
Overview ¶
package mapper is collection of small mapping helpers.
Index ¶
- func Cancellable[V any](n int, ctx context.Context, seq iter.Seq[V]) iter.Seq[V]
- func Cancellable2[K, V any](n int, ctx context.Context, seq iter.Seq2[K, V]) iter.Seq2[K, V]
- func Clone[S ~[]E, E any](seq iter.Seq[S]) iter.Seq[S]
- func Clone2[S1 ~[]E1, S2 ~[]E2, E1, E2 any](seq iter.Seq2[S1, S2]) iter.Seq2[S1, S2]
- func Collect[V any](seq iter.Seq[iter.Seq[V]]) iter.Seq[[]V]
- func Collect2[K, V any](seq iter.Seq2[iter.Seq[K], iter.Seq[V]]) iter.Seq2[[]K, []V]
- func HandleErr[V any](handle func(V, error) bool, seq iter.Seq2[V, error]) iter.Seq[V]
- func Sprintf[V any](format string, seq iter.Seq[V]) iter.Seq[string]
- func Sprintf2[K, V any](format string, seq iter.Seq2[K, V]) iter.Seq[string]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cancellable ¶
Cancellable returns an iterator over seq but it also checks if ctx is cancelled each n elements seq yields.
func Cancellable2 ¶
Cancellable2 returns an iterator over seq but it also checks if ctx is cancelled each n elements seq yields.
func Clone2 ¶
Clone2 maps seq by slices.Clone.
func Collect ¶
Collect maps seq by slices.Collect.
func Collect2 ¶
Collect2 maps seq by slices.Collect.
func HandleErr ¶
HandleErr returns an iterator over only former value of seq. If latter value the seq yields is non-nil then it calls handle. If handle returns false the iterator stops. Even if handle returns true, values paired to non-nil error are excluded from the returned iterator.
func Sprintf ¶
Sprintf maps seq by fmt.Sprintf
func Sprintf2 ¶
Sprintf2 maps seq by fmt.Sprintf
format receives k as fist and v as second. If callers need reversed order, callers should use %[1]verb and %[2]verb. see https://pkg.go.dev/fmt@go1.23.3#hdr-Explicit_argument_indexes.
Types ¶
This section is empty.