Documentation
¶
Overview ¶
Package iterhelper contains iter package helpers.
Index ¶
- Variables
- func Empty[Result any]() iter.Seq[Result]
- func Empty2[K, V any]() iter.Seq2[K, V]
- func ForEach[T any](ctx context.Context, seq iter.Seq[T], action func(T) error) error
- func ForEachConcurrent[T any](ctx context.Context, seq iter.Seq[T], action func(T) error) error
- func Seq2Seq[K, V, V2 any](seq2 iter.Seq2[K, V], selector func(K, V) V2) (iter.Seq[V2], error)
- func Seq2SeqK[K, V any](seq2 iter.Seq2[K, V]) (iter.Seq[K], error)
- func Seq2SeqV[K, V any](seq2 iter.Seq2[K, V]) (iter.Seq[V], error)
- func SeqSeq2[V, K2, V2 any](seq iter.Seq[V], selector func(V) (K2, V2)) (iter.Seq2[K2, V2], error)
- func SequenceEqual[Source any](first, second iter.Seq[Source]) (bool, error)
- func SequenceEqual2[K, V any](first, second iter.Seq2[K, V]) (bool, error)
- func SequenceEqual2Eq[K, V any](first, second iter.Seq2[K, V], equalK func(K, K) bool, equalV func(V, V) bool) (bool, error)
- func SequenceEqualEq[Source any](first, second iter.Seq[Source], equal func(Source, Source) bool) (bool, error)
- func StringDef[T any](seq iter.Seq[T]) string
- func StringDef2[K, V any](seq2 iter.Seq2[K, V]) string
- func StringFmt[T any](seq iter.Seq[T], sep, lrim, rrim, ledge, redge string) string
- func StringFmt2[K, V any](seq2 iter.Seq2[K, V], psep, esep, lrim, rrim, ledge, redge string) string
- func StringSeq[T any](seq iter.Seq[T]) (iter.Seq[string], error)
- func StringSlice[T any](seq iter.Seq[T]) ([]string, error)
- func VarSeq[E any](s ...E) iter.Seq[E]
- func VarSeq2[K, V any](tt ...generichelper.Tuple2[K, V]) iter.Seq2[K, V]
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ForEach ¶ added in v0.2.0
ForEach sequentially performs a specified 'action' on each element of the sequence. If 'ctx' is canceled or 'action' returns non-nil error, operation is stopped and corresponding error is returned.
func ForEachConcurrent ¶ added in v0.2.0
ForEachConcurrent concurrently performs a specified 'action' on each element of the sequence. If 'ctx' is canceled or 'action' returns non-nil error, operation is stopped and corresponding error is returned.
func SequenceEqual ¶ added in v0.2.0
SequenceEqual determines whether two sequences are equal by comparing their elements using generichelper.DeepEqual.
func SequenceEqual2 ¶ added in v0.2.0
SequenceEqual2 determines whether two sequences are equal by comparing their elements using generichelper.DeepEqual.
func SequenceEqual2Eq ¶ added in v0.2.0
func SequenceEqual2Eq[K, V any](first, second iter.Seq2[K, V], equalK func(K, K) bool, equalV func(V, V) bool) (bool, error)
SequenceEqual2Eq determines whether two sequences are equal by comparing their elements using specified equals.
func SequenceEqualEq ¶ added in v0.2.0
func SequenceEqualEq[Source any](first, second iter.Seq[Source], equal func(Source, Source) bool) (bool, error)
SequenceEqualEq determines whether two sequences are equal by comparing their elements using a specified function.
func StringDef ¶ added in v0.2.0
StringDef returns string representation of a sequence using default formatting. If 'seq' is nil, empty string is returned.
func StringDef2 ¶ added in v0.2.0
StringDef2 returns string representation of a sequence using default formatting. If 'seq2' is nil, empty string is returned.
func StringFmt ¶ added in v0.2.0
StringFmt returns string representation of a sequence:
- if 'seq' is nil, empty string is returned;
- if 'T' implements fmt.Stringer, it is used to convert each element to string;
- 'sep' separates elements;
- 'lrim' and 'rrim' surround each element;
- 'ledge' and 'redge' surround the whole string.
func StringFmt2 ¶ added in v0.2.0
StringFmt2 returns string representation of a sequence:
- if 'seq2' is nil, empty string is returned;
- if 'T' implements fmt.Stringer, it is used to convert each element to string;
- 'psep' separates pair of values;
- 'esep' separates elements;
- 'lrim' and 'rrim' surround each element;
- 'ledge' and 'redge' surround the whole string.
func StringSlice ¶ added in v0.2.0
StringSlice returns a sequence contents as a slice of strings.
Types ¶
This section is empty.