Documentation
ΒΆ
Index ΒΆ
- type DeferredJoinIterable
- func (iterable DeferredJoinIterable[T]) AsPairs() Iterable[any]
- func (iterable DeferredJoinIterable[T]) AsThis(joinSelector func(T, any) any) Iterable[any]
- func (iterable DeferredJoinIterable[T]) Equals(fieldName string) DeferredJoinIterable[T]
- func (iterable DeferredJoinIterable[T]) EqualsThis(rightKeySelector func(any) any) DeferredJoinIterable[T]
- func (iterable DeferredJoinIterable[T]) On(fieldName string) DeferredJoinIterable[T]
- func (iterable DeferredJoinIterable[T]) OnThis(keySelector func(T) any) DeferredJoinIterable[T]
- type DeferredKeyMapIterable
- type Iterable
- func (iterable Iterable[T]) AndAssignToSlice(result any)
- func (iterable Iterable[T]) AsAny() Iterable[any]
- func (iterable Iterable[T]) Distinct() Iterable[T]
- func (iterable Iterable[T]) FilterOn(fieldName string) Iterable[T]
- func (iterable Iterable[T]) FilterOnThis(predicate func(T) bool) Iterable[T]
- func (iterable Iterable[T]) Get(fieldName string) Iterable[any]
- func (iterable Iterable[T]) GetThese(selector func(T) any) Iterable[any]
- func (iterable Iterable[T]) Group(fieldName string) DeferredKeyMapIterable[T]
- func (iterable Iterable[T]) GroupBy(fieldName string) MapIterable[T]
- func (iterable Iterable[T]) GroupByThis(selector func(T) any) MapIterable[T]
- func (iterable Iterable[T]) GroupListsBy(fieldName string) MapIterable[T]
- func (iterable Iterable[T]) GroupListsByThis(selector func(T) any) MapIterable[T]
- func (iterable Iterable[T]) GroupListsOf(fieldName string) DeferredKeyMapIterable[T]
- func (iterable Iterable[T]) GroupListsOfThis(selector func(T) any) DeferredKeyMapIterable[T]
- func (iterable Iterable[T]) GroupThis(selector func(T) any) DeferredKeyMapIterable[T]
- func (iterable Iterable[T]) Join(joinIterable Iterable[any]) DeferredJoinIterable[T]
- func (iterable Iterable[T]) JoinSlice(joinSlice any) DeferredJoinIterable[T]
- type JoinIterable
- type MapIterable
- type Pair
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type DeferredJoinIterable ΒΆ
type DeferredJoinIterable[T any] JoinIterable[T]
DeferredJoinIterable is a JoinIterable where the key selectors have not yet been set. Designed to be used in tandem with the On and Equals functions. Has very little use outside of that.
func (DeferredJoinIterable[T]) AsPairs ΒΆ
func (iterable DeferredJoinIterable[T]) AsPairs() Iterable[any]
AsPairs projects the joined items as Pair structs.
func (DeferredJoinIterable[T]) AsThis ΒΆ
func (iterable DeferredJoinIterable[T]) AsThis(joinSelector func(T, any) any) Iterable[any]
AsThis projects the joined items using the given joinSelector function.
func (DeferredJoinIterable[T]) Equals ΒΆ
func (iterable DeferredJoinIterable[T]) Equals(fieldName string) DeferredJoinIterable[T]
Equals sets the right key selector function using the given field name.
func (DeferredJoinIterable[T]) EqualsThis ΒΆ
func (iterable DeferredJoinIterable[T]) EqualsThis(rightKeySelector func(any) any) DeferredJoinIterable[T]
EqualsThis sets the right key selector function.
func (DeferredJoinIterable[T]) On ΒΆ
func (iterable DeferredJoinIterable[T]) On(fieldName string) DeferredJoinIterable[T]
On sets the key selector functions for both left and right iterables using the given field name.
func (DeferredJoinIterable[T]) OnThis ΒΆ
func (iterable DeferredJoinIterable[T]) OnThis(keySelector func(T) any) DeferredJoinIterable[T]
OnThis sets the key selector functions for both left and right iterables.
type DeferredKeyMapIterable ΒΆ
type DeferredKeyMapIterable[T any] MapIterable[T]
DeferredKeyMapIterable is a MapIterable where the key selector has not yet been set. Designed to be used in tandem with the By functions. Has very little use outside of that.
func (DeferredKeyMapIterable[T]) By ΒΆ
func (iterable DeferredKeyMapIterable[T]) By(fieldName string) MapIterable[T]
By returns a new MapIterable where the items are grouped by the given field name. Callable from other MapIterables. Designed to be used in tandem with the GroupThis or GroupListsOfThis functions. Items with the same key will NOT be overwritten as this iterable is iterated.
func (DeferredKeyMapIterable[T]) ByThis ΒΆ
func (iterable DeferredKeyMapIterable[T]) ByThis(selector func(T) any) MapIterable[T]
ByThis returns a new MapIterable where the items are grouped by the given key selector. Callable from other MapIterables. Designed to be used in tandem with the GroupThis or GroupListsOfThis functions. Items with the same key will NOT be overwritten as this iterable is iterated.
type Iterable ΒΆ
Iterable is the base structure for an iterable. It allows for the lazy iteration of a collection of items and exists to allow functions to be called on the collection.
func (Iterable[T]) AndAssignToSlice ΒΆ
AndAssignToSlice assigns the result of iterating over the Iterable to a slice. The type of the result slice must be the same as the type of the item in the Iterable. If there is a type mismatch, or the result is not a pointer to a slice, this function will panic.
func (Iterable[T]) FilterOn ΒΆ
FilterOn returns a new Iterable where the items are filtered by the given fieldName. If T is not a struct, or fieldName is not found, this function will panic.
func (Iterable[T]) FilterOnThis ΒΆ
FilterOnThis returns a new Iterable where the items are filtered by the given predicate.
func (Iterable[T]) Get ΒΆ
Get returns a new Iterable where the items are transformed by fieldName. If T is not a struct, or fieldName is not found, this function will panic.
func (Iterable[T]) GetThese ΒΆ
GetThese returns a new Iterable where the items are transformed by selector.
func (Iterable[T]) Group ΒΆ
func (iterable Iterable[T]) Group(fieldName string) DeferredKeyMapIterable[T]
Group returns a new MapIterable where the items are grouped by the given field name. Items with the same key WILL BE OVERWRITTEN as this iterable is iterated. Should be used in tandem with the By functions. Has very little use outside of that. If T is not a struct, or fieldName is not found, this function will panic.
func (Iterable[T]) GroupBy ΒΆ
func (iterable Iterable[T]) GroupBy(fieldName string) MapIterable[T]
GroupBy returns a new MapIterable where the items are grouped by the given field name. Items with the same key WILL BE OVERWRITTEN as this iterable is iterated. If T is not a struct, or fieldName is not found, this function will panic.
func (Iterable[T]) GroupByThis ΒΆ
func (iterable Iterable[T]) GroupByThis(selector func(T) any) MapIterable[T]
GroupByThis returns a new MapIterable where the items are grouped by the given key selector. Items with the same key WILL BE OVERWRITTEN as this iterable is iterated.
func (Iterable[T]) GroupListsBy ΒΆ
func (iterable Iterable[T]) GroupListsBy(fieldName string) MapIterable[T]
GroupListsBy returns a new MapIterable where the items are grouped by the given field name. Items with the same key will NOT be overwritten as this iterable is iterated. If T is not a struct, or fieldName is not found, this function will panic.
func (Iterable[T]) GroupListsByThis ΒΆ
func (iterable Iterable[T]) GroupListsByThis(selector func(T) any) MapIterable[T]
GroupListsByThis returns a new MapIterable where the items are grouped by the given key selector. Items with the same key will NOT be overwritten as this iterable is iterated.
func (Iterable[T]) GroupListsOf ΒΆ
func (iterable Iterable[T]) GroupListsOf(fieldName string) DeferredKeyMapIterable[T]
GroupListsOf returns a new MapIterable where the items are grouped by the given field name. Items with the same key will NOT be overwritten as this iterable is iterated. Should be used in tandem with the By functions. Has very little use outside of that. If T is not a struct, or fieldName is not found, this function will panic.
func (Iterable[T]) GroupListsOfThis ΒΆ
func (iterable Iterable[T]) GroupListsOfThis(selector func(T) any) DeferredKeyMapIterable[T]
GroupListsOfThis returns a new MapIterable where the items are grouped by the given selector. Items with the same key will NOT be overwritten as this iterable is iterated. Should be used in tandem with the By functions. Has very little use outside of that.
func (Iterable[T]) GroupThis ΒΆ
func (iterable Iterable[T]) GroupThis(selector func(T) any) DeferredKeyMapIterable[T]
GroupThis returns a new MapIterable where the items are grouped by the given selector. Items with the same key WILL BE OVERWRITTEN as this iterable is iterated. Should be used in tandem with the By functions. Has very little use outside of that.
func (Iterable[T]) Join ΒΆ
func (iterable Iterable[T]) Join(joinIterable Iterable[any]) DeferredJoinIterable[T]
Join returns a new DeferredJoinIterable that will join the items of the given iterable
func (Iterable[T]) JoinSlice ΒΆ
func (iterable Iterable[T]) JoinSlice(joinSlice any) DeferredJoinIterable[T]
JoinSlice returns a new DeferredJoinIterable that will join the items of the given slice
type JoinIterable ΒΆ
type JoinIterable[T any] struct { // contains filtered or unexported fields }
JoinIterable is a specialized iterable that includes a right iterable, a key selector for the left iterable, and a key selector for the right iterable. These selectors are stored until the collection is iterated, and then applied to the items.
type MapIterable ΒΆ
type MapIterable[T any] struct { // contains filtered or unexported fields }
MapIterable is a specialized iterable that includes a key selector and an item selector. These selectors are stored until the collection is iterated, and then applied to the items. The Overwrite flag determines whether the map value for a given key should be overwritten or appended to. If set to true, the result map will be expected to be a map[K]V, and if set to false, the result map will be expected to be a map[K][]V.
func (MapIterable[T]) AndAssignToMap ΒΆ
func (iterable MapIterable[T]) AndAssignToMap(result any)
AndAssignToMap assigns the result of iterating over the MapIterable to a map. The type of the result map must be the same as the type of the key and value selector results in the MapIterable. If there is a key or value type mismatch, or the result is not a pointer to a map, this function will panic. If the MapIterable is set to overwrite, this function will attempt to build a slice of the value type, or append to the value if it already exists.