linq

package
v0.0.0-...-0d409a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinqAggregate

func LinqAggregate[T any, P any](obj []T, reducer func(T, P) P, acc P) P

func LinqAggregateIterable

func LinqAggregateIterable[T any, TV IIterable[T], P any](obj TV, reducer func(T, P) P, acc P) P

func LinqAll

func LinqAll[T any](obj []T, predicate func(T) bool) bool

func LinqAllIterable

func LinqAllIterable[T any, TV IIterable[T]](obj TV, predicate func(T) bool) bool

func LinqAny

func LinqAny[T any](obj []T, predicate func(T) bool) bool

func LinqAnyIterable

func LinqAnyIterable[T any, TV IIterable[T]](obj TV, predicate func(T) bool) bool

func LinqContains

func LinqContains[T comparable](obj []T, searchValue T) bool

func LinqContainsIterable

func LinqContainsIterable[T comparable, TV IIterable[T]](obj TV, searchValue T) bool

func LinqCount

func LinqCount[T any](obj []T) int

func LinqCountIterable

func LinqCountIterable[T any, TV IIterable[T]](obj TV) int

func LinqEach

func LinqEach[T any](obj []T, action func(T))

func LinqEachIterable

func LinqEachIterable[T any, TV IIterable[T]](obj TV, action func(T))

func LinqFind

func LinqFind[T any](obj []T, predicate func(T) bool) Nullable[T]

func LinqFindIterable

func LinqFindIterable[T any, TV IIterable[T]](obj TV, predicate func(T) bool) Nullable[T]

func LinqGroupBy

func LinqGroupBy[T any, K comparable](obj []T, keyGenerator func(T) K) map[K][]T

func LinqGroupByIterable

func LinqGroupByIterable[T any, TV IIterable[T], K comparable](obj TV, keyGenerator func(T) K) map[K][]T

func LinqJoin

func LinqJoin[T any](objs ...[]T) (result []T)

func LinqJoinIterable

func LinqJoinIterable[T any, TV IIterable[T]](objs ...TV) (result []T)

func LinqLast

func LinqLast[T any](obj []T) T

func LinqLastIterable

func LinqLastIterable[T any, TV IIterable[T]](obj TV) T

func LinqMax

func LinqMax[T constraints.Ordered](obj []T) T

func LinqMaxIterable

func LinqMaxIterable[T constraints.Ordered, TV IIterable[T]](obj TV) T

func LinqMin

func LinqMin[T constraints.Ordered](obj []T) T

func LinqMinIterable

func LinqMinIterable[T constraints.Ordered, TV IIterable[T]](obj TV) T

func LinqReduce

func LinqReduce[T any, P any](obj []T, reducer func(T, P) P, acc P) P

func LinqReduceIterable

func LinqReduceIterable[T any, TV IIterable[T], P any](obj TV, reducer func(T, P) P, acc P) P

func LinqSelect

func LinqSelect[IT any, OT any](obj []IT, predicate func(IT) OT) (result []OT)

func LinqSelectIterable

func LinqSelectIterable[IT any, TV IIterable[IT], OT any](obj TV, predicate func(IT) OT) (result []OT)

func LinqSkip

func LinqSkip[T any](obj []T, count int) []T

func LinqSkipIterable

func LinqSkipIterable[T any, TV IIterable[T]](obj TV, count int) (result []T)

func LinqSum

func LinqSum[T constraints.Ordered](obj []T) (sum T)

func LinqSumBy

func LinqSumBy[T any, R constraints.Ordered](obj []T, selector func(T) R) (sum R)

func LinqSumByIterable

func LinqSumByIterable[T any, TV IIterable[T], R constraints.Ordered](obj TV, selector func(T) R) (sum R)

func LinqSumIterable

func LinqSumIterable[T constraints.Ordered, TV IIterable[T]](obj TV) (sum T)

func LinqTake

func LinqTake[T any](obj []T, count int) []T

func LinqTakeIterable

func LinqTakeIterable[T any, TV IIterable[T]](obj TV, count int) (result []T)

func LinqToArray

func LinqToArray[T any](obj []T) []T

func LinqToArrayIterable

func LinqToArrayIterable[T any, TV IIterable[T]](obj TV) (result []T)

func LinqWhere

func LinqWhere[T any](obj []T, predicate func(T) bool) (result []T)

func LinqWhereIterable

func LinqWhereIterable[T any, TV IIterable[T]](obj TV, predicate func(T) bool) (result []T)

Types

type IEnumerable

type IEnumerable[TV any] interface {
	*[]TV | *map[int]TV | *map[string]TV
}

type IEnumerableV

type IEnumerableV[TK comparable, TV any] interface {
	*map[TK]TV
}

type IIterable

type IIterable[TV any] interface {
	Next() (TV, bool)
}

type IIterableV

type IIterableV[TK comparable, TV any] interface {
	Next() (TK, TV, bool)
}

type IResetableIterable

type IResetableIterable[TV any] interface {
	Reset()
	Next() (TV, bool)
}

type IResetableIterableV

type IResetableIterableV[TK comparable, TV any] interface {
	Reset()
	Next() (TK, TV, bool)
}

type IterableSlice

type IterableSlice[TV any] struct {
	// contains filtered or unexported fields
}

func (*IterableSlice[TV]) Next

func (is *IterableSlice[TV]) Next() (TV, bool)

func (*IterableSlice[TV]) Reset

func (is *IterableSlice[TV]) Reset()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL