Documentation
¶
Overview ¶
See: zeromicro/go-zero/core/stream
Index ¶
- func Collect[T any, A any, R any](s Stream[T], collector collectors.Collector[T, A, R]) R
- func GoSafe(fn func())
- func GroupingBy[T any, K string | int | int32 | int64, R any](s Stream[T], keyMapper func(T) K, valueMapper func(T) R, opts ...OptFunc[R]) map[K][]R
- func Recover(cleanups ...func())
- func RequireNonNil(obj any)
- func RunSafe(fn func())
- type OptFunc
- type Optional
- type Stream
- func Concat[T any](s Stream[T], others ...Stream[T]) Stream[T]
- func FlatMap[T any, R any](s Stream[T], mapper func(T) Stream[R]) Stream[R]
- func Map[T any, R any](s Stream[T], mapper func(T) R) Stream[R]
- func Of[T any](values ...T) Stream[T]
- func OfFrom[T any](generate func(source chan<- T)) Stream[T]
- func OfFromParallel[T any](generate func(source chan<- T)) Stream[T]
- func OfParallel[T any](values ...T) Stream[T]
- func Range[T any](source <-chan T, isParallel bool) Stream[T]
- func (s Stream[T]) AllMatch(predicate func(T) bool) bool
- func (s Stream[T]) AnyMatch(predicate func(T) bool) bool
- func (s Stream[T]) Collect(collector collectors.Collector[T, T, any]) anydeprecated
- func (s Stream[T]) Concat(others ...Stream[T]) Stream[T]
- func (s Stream[T]) Count() (count int64)
- func (s Stream[T]) Distinct(fn func(item T) any) Stream[T]
- func (s Stream[T]) DropWhile(fn func(item T) bool) Stream[T]
- func (s Stream[T]) Filter(fn func(item T) bool) Stream[T]
- func (s Stream[T]) FindFirst() Optional[T]
- func (s Stream[T]) FindLast() Optional[T]
- func (s Stream[T]) FlatMap(mapper func(T) Stream[T]) Stream[T]
- func (s Stream[T]) FlatMapToFloat32(mapper func(T) Stream[float32]) Stream[float32]
- func (s Stream[T]) FlatMapToFloat64(mapper func(T) Stream[float64]) Stream[float64]
- func (s Stream[T]) FlatMapToInt(mapper func(T) Stream[int]) Stream[int]
- func (s Stream[T]) FlatMapToInt32(mapper func(T) Stream[int32]) Stream[int32]
- func (s Stream[T]) FlatMapToInt64(mapper func(T) Stream[int64]) Stream[int64]
- func (s Stream[T]) FlatMapToString(mapper func(T) Stream[string]) Stream[string]
- func (s Stream[T]) ForEach(fn func(item T))
- func (s Stream[T]) GroupingByInt(groupFunc func(T) int, opts ...OptFunc[T]) map[int][]T
- func (s Stream[T]) GroupingByString(groupFunc func(T) string, opts ...OptFunc[T]) map[string][]T
- func (s Stream[T]) Joining(seq string) string
- func (s Stream[T]) Limit(maxSize int64) Stream[T]
- func (s Stream[T]) Map(fn func(item T) any) Stream[any]
- func (s Stream[T]) MapToFloat32(mapper func(T) float32) Stream[float32]
- func (s Stream[T]) MapToFloat64(mapper func(T) float64) Stream[float64]
- func (s Stream[T]) MapToInt(mapper func(T) int) Stream[int]
- func (s Stream[T]) MapToInt32(mapper func(T) int32) Stream[int32]
- func (s Stream[T]) MapToInt64(mapper func(T) int64) Stream[int64]
- func (s Stream[T]) MapToString(mapper func(T) string) Stream[string]
- func (s Stream[T]) Max(comparator func(T, T) int) Optional[T]
- func (s Stream[T]) Min(comparator func(T, T) int) Optional[T]
- func (s Stream[T]) NoneMatch(predicate func(T) bool) bool
- func (s Stream[T]) Peek(fn func(item *T)) Stream[T]
- func (s Stream[T]) PeekP(fn func(item T)) Stream[T]
- func (s Stream[T]) Reduce(accumulator func(T, T) T) Optional[T]
- func (s Stream[T]) Reverse() Stream[T]
- func (s Stream[T]) Skip(n int64) Stream[T]
- func (s Stream[T]) Sorted(less func(a, b T) bool) Stream[T]
- func (s Stream[T]) SumFloat32Statistics() SumFloatStatistics[float32]
- func (s Stream[T]) SumFloat64Statistics() SumFloatStatistics[float64]
- func (s Stream[T]) SumInt32Statistics() SumIntStatistics[int32]
- func (s Stream[T]) SumInt64Statistics() SumIntStatistics[int64]
- func (s Stream[T]) SumIntStatistics() SumIntStatistics[int]
- func (s Stream[T]) TakeWhile(fn func(item T) bool) Stream[T]
- func (s Stream[T]) ToMapInt(keyMapper func(T) int, valueMapper func(T) T, opts ...func(oldV, newV T) T) map[int]T
- func (s Stream[T]) ToMapString(keyMapper func(T) string, valueMapper func(T) T, opts ...func(oldV, newV T) T) map[string]T
- func (s Stream[T]) ToSlice() []T
- func (s Stream[T]) Walk(fn func(item T, pipe chan<- T)) Stream[T]
- type SumFloatStatistics
- type SumIntStatistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GroupingBy ¶ added in v1.0.5
func RequireNonNil ¶ added in v1.1.2
func RequireNonNil(obj any)
Types ¶
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
func OfOptional ¶ added in v1.1.2
func OfOptional[T any](t *T) Optional[T]
func OfOptionalNilable ¶ added in v1.1.2
func OfOptionalNilable[T any](t *T) Optional[T]
type Stream ¶
type Stream[T any] struct { // contains filtered or unexported fields }
func Map ¶
Map stream 流 类型转换方法
eg:
res := Map(Of(
TestItem{itemNum: 1, itemValue: "item1"}, TestItem{itemNum: 2, itemValue: "item2"}, TestItem{itemNum: 3, itemValue: "item3"}, ), func(item TestItem) ToTestItem { return ToTestItem{ itemNum: item.itemNum, itemValue: item.itemValue, } }).ToSlice() fmt.Println(res)
func OfFromParallel ¶
func OfParallel ¶
func (Stream[T]) FlatMapToFloat32 ¶ added in v1.0.4
func (Stream[T]) FlatMapToFloat64 ¶ added in v1.0.4
func (Stream[T]) FlatMapToInt ¶
func (Stream[T]) FlatMapToInt32 ¶ added in v1.0.4
func (Stream[T]) FlatMapToInt64 ¶ added in v1.0.4
func (Stream[T]) FlatMapToString ¶ added in v1.0.3
func (Stream[T]) GroupingByInt ¶ added in v1.0.5
func (Stream[T]) GroupingByString ¶ added in v1.0.5
func (Stream[T]) MapToFloat32 ¶ added in v1.0.4
func (Stream[T]) MapToFloat64 ¶ added in v1.0.4
func (Stream[T]) MapToInt32 ¶ added in v1.0.4
func (Stream[T]) MapToInt64 ¶ added in v1.0.4
func (Stream[T]) MapToString ¶ added in v1.0.3
func (Stream[T]) SumFloat32Statistics ¶ added in v1.1.0
func (s Stream[T]) SumFloat32Statistics() SumFloatStatistics[float32]
func (Stream[T]) SumFloat64Statistics ¶ added in v1.0.4
func (s Stream[T]) SumFloat64Statistics() SumFloatStatistics[float64]
func (Stream[T]) SumInt32Statistics ¶ added in v1.0.4
func (s Stream[T]) SumInt32Statistics() SumIntStatistics[int32]
func (Stream[T]) SumInt64Statistics ¶ added in v1.0.4
func (s Stream[T]) SumInt64Statistics() SumIntStatistics[int64]
func (Stream[T]) SumIntStatistics ¶ added in v1.0.4
func (s Stream[T]) SumIntStatistics() SumIntStatistics[int]
func (Stream[T]) ToMapString ¶ added in v1.1.0
type SumFloatStatistics ¶ added in v1.0.4
type SumFloatStatistics[T float32 | float64] struct { Count int64 Sum float64 Max T Min T Average float64 }
func (SumFloatStatistics[T]) GetAverage ¶ added in v1.0.4
func (s SumFloatStatistics[T]) GetAverage() float64
func (SumFloatStatistics[T]) GetCount ¶ added in v1.0.4
func (s SumFloatStatistics[T]) GetCount() int64
func (SumFloatStatistics[T]) GetMax ¶ added in v1.0.4
func (s SumFloatStatistics[T]) GetMax() T
func (SumFloatStatistics[T]) GetMin ¶ added in v1.0.4
func (s SumFloatStatistics[T]) GetMin() T
func (SumFloatStatistics[T]) GetSum ¶ added in v1.0.4
func (s SumFloatStatistics[T]) GetSum() float64
type SumIntStatistics ¶ added in v1.0.4
type SumIntStatistics[T int | int32 | int64] struct { Count int64 Sum int64 Max T Min T Average float64 }
func (SumIntStatistics[T]) GetAverage ¶ added in v1.0.4
func (s SumIntStatistics[T]) GetAverage() float64
func (SumIntStatistics[T]) GetCount ¶ added in v1.0.4
func (s SumIntStatistics[T]) GetCount() int64
func (SumIntStatistics[T]) GetMax ¶ added in v1.0.4
func (s SumIntStatistics[T]) GetMax() T
func (SumIntStatistics[T]) GetMin ¶ added in v1.0.4
func (s SumIntStatistics[T]) GetMin() T
func (SumIntStatistics[T]) GetSum ¶ added in v1.0.4
func (s SumIntStatistics[T]) GetSum() int64
Click to show internal directories.
Click to hide internal directories.