Options
All
  • Public
  • Public/Protected
  • All
Menu

Implementation class for IQueryIterator that may be used by custom database adapters.

Type parameters

  • T

Hierarchy

  • QueryIterator

Implements

Index

Constructors

constructor

Properties

batchSize

batchSize: number

forBatchAction

forBatchAction: (batch: T[]) => boolean | void

Type declaration

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

      • batch: T[]

      Returns boolean | void

forEachAction

forEachAction: (result: T, index: number) => boolean | void

Type declaration

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

      • result: T
      • index: number

      Returns boolean | void

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

    • batchSize: number = 0

    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]>

setDonePromise

  • setDonePromise(donePromise: Promise<[number, boolean]>): void

setStarter

  • setStarter(starter: () => void): void

Generated using TypeDoc