Skip to main content Link Search Menu Expand Document (external link)

GroupBy overview

Added in v2.0.0


Table of contents


constructors

make

Constructs a GroupBy from a Stream.

Signature

export declare const make: <K, V, E, R>(
  grouped: Stream.Stream<readonly [K, Queue.Dequeue<Take.Take<V, E>>], E, R>
) => GroupBy<K, V, E, R>

Added in v2.0.0

destructors

evaluate

Run the function across all groups, collecting the results in an arbitrary order.

Signature

export declare const evaluate: {
  <K, V, E, A, E2, R2>(
    f: (key: K, stream: Stream.Stream<V, E, never>) => Stream.Stream<A, E2, R2>,
    options?: { readonly bufferSize?: number | undefined } | undefined
  ): <R>(self: GroupBy<K, V, E, R>) => Stream.Stream<A, E | E2, R2 | R>
  <K, V, E, R, A, E2, R2>(
    self: GroupBy<K, V, E, R>,
    f: (key: K, stream: Stream.Stream<V, E, never>) => Stream.Stream<A, E2, R2>,
    options?: { readonly bufferSize?: number | undefined } | undefined
  ): Stream.Stream<A, E | E2, R | R2>
}

Added in v2.0.0

models

GroupBy (interface)

Representation of a grouped stream. This allows to filter which groups will be processed. Once this is applied all groups will be processed in parallel and the results will be merged in arbitrary order.

Signature

export interface GroupBy<out K, out V, out E = never, out R = never> extends GroupBy.Variance<K, V, E, R>, Pipeable {
  readonly grouped: Stream.Stream<readonly [K, Queue.Dequeue<Take.Take<V, E>>], E, R>
}

Added in v2.0.0

symbols

GroupByTypeId

Signature

export declare const GroupByTypeId: typeof GroupByTypeId

Added in v2.0.0

GroupByTypeId (type alias)

Signature

export type GroupByTypeId = typeof GroupByTypeId

Added in v2.0.0

utils

GroupBy (namespace)

Added in v2.0.0

Variance (interface)

Signature

export interface Variance<out K, out V, out E, out R> {
  readonly [GroupByTypeId]: {
    readonly _K: Covariant<K>
    readonly _V: Covariant<V>
    readonly _E: Covariant<E>
    readonly _R: Covariant<R>
  }
}

Added in v2.0.0

filter

Filter the groups to be processed.

Signature

export declare const filter: {
  <K>(predicate: Predicate<NoInfer<K>>): <V, E, R>(self: GroupBy<K, V, E, R>) => GroupBy<K, V, E, R>
  <K, V, E, R>(self: GroupBy<K, V, E, R>, predicate: Predicate<K>): GroupBy<K, V, E, R>
}

Added in v2.0.0

first

Only consider the first n groups found in the Stream.

Signature

export declare const first: {
  (n: number): <K, V, E, R>(self: GroupBy<K, V, E, R>) => GroupBy<K, V, E, R>
  <K, V, E, R>(self: GroupBy<K, V, E, R>, n: number): GroupBy<K, V, E, R>
}

Added in v2.0.0