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

GroupBy overview

Added in v1.0.0


Table of contents


constructors

make

Constructs a GroupBy from a Stream.

Signature

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

Added in v1.0.0

destructors

evaluate

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

Signature

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

Added in v1.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<R, E, K, V> extends GroupBy.Variance<R, E, K, V>, Pipeable {
  readonly grouped: Stream.Stream<R, E, readonly [K, Queue.Dequeue<Take.Take<E, V>>]>
}

Added in v1.0.0

symbols

GroupByTypeId

Signature

export declare const GroupByTypeId: typeof GroupByTypeId

Added in v1.0.0

GroupByTypeId (type alias)

Signature

export type GroupByTypeId = typeof GroupByTypeId

Added in v1.0.0

utils

GroupBy (namespace)

Added in v1.0.0

Variance (interface)

Signature

export interface Variance<R, E, K, V> {
  readonly [GroupByTypeId]: {
    readonly _R: (_: never) => R
    readonly _E: (_: never) => E
    readonly _K: (_: never) => K
    readonly _V: (_: never) => V
  }
}

Added in v1.0.0

filter

Filter the groups to be processed.

Signature

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

Added in v1.0.0

first

Only consider the first n groups found in the Stream.

Signature

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

Added in v1.0.0