Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IQueryIterator<T>

Used to iterate the query results of the given type. The results can be iterated either one by one or in batches. Use the promise returned by the iterator functions to await completion or failure of the iteration.

Type parameters

  • T

Hierarchy

  • IQueryIterator

Implemented by

Index

Methods

forBatch

  • forBatch(action: (batch: T[]) => boolean | void, batchSize?: number): Promise<[number, boolean]>
  • Registers a synchronous action to be invoked on each batch of results of the iterated sequence. Note that the last batch array passed to the action callback may have less elements than specified by batchSize. If batchSize is not specified, zero or negative, all the results are accumulated in one batch.

    To break out of the iteration prematurely return false from the action callback. Return no value (i.e undefined), or any non false value to continue iteration.

    Returns a promise that is fulfilled when the iteration has finished successfully. In this case the promise yields a tuple whose first value specifies the total number of results submitted in batches (may be 0) and whose second value is true if the iteration has been stopped in the action callback; false otherwise. The promise is rejected if the iteration yields an error.

    Parameters

    • action: (batch: T[]) => boolean | void
        • (batch: T[]): boolean | void
        • Parameters

          • batch: T[]

          Returns boolean | void

    • Optional batchSize: number

    Returns Promise<[number, boolean]>

forEach

  • forEach(action: (result: T, index: number) => boolean | void): Promise<[number, boolean]>
  • Registers a synchronous action to be invoked on each result of the iterated sequence.

    To break out of the iteration prematurely return false from the action callback. Return no value (i.e undefined) any non false value to continue iteration.

    Returns a promise that is fulfilled when the iteration has finished successfully. In this case the promise yields a tuple whose first value specifies the total number of iterations performed (i.e. total number of action callback invocations, may be 0) and whose second value is true if the iteration has been stopped in the action callback; false otherwise. The promise is rejected if the iteration yields an error.

    Parameters

    • action: (result: T, index: number) => boolean | void
        • (result: T, index: number): boolean | void
        • Parameters

          • result: T
          • index: number

          Returns boolean | void

    Returns Promise<[number, boolean]>

Generated using TypeDoc