Class FoldIndex<In, State, Return>

An aggregate index that folds over the change events it receives.

The time and memory complexity of this index completely depends on the complexities of the functions passed to it.

See

foldIndex as a constructor.

Type Parameters

  • In

  • State

  • Return

Hierarchy

Constructors

Properties

Methods

Constructors

  • Type Parameters

    • In

    • State

    • Return

    Parameters

    • ctx: IndexContext<any>
    • init: State
    • add: ((state, value) => State)
        • (state, value): State
        • Parameters

          • state: State
          • value: In

          Returns State

    • update: ((state, oldValue, newValue) => State)
        • (state, oldValue, newValue): State
        • Parameters

          • state: State
          • oldValue: In
          • newValue: In

          Returns State

    • del: ((state, oldValue) => State)
        • (state, oldValue): State
        • Parameters

          • state: State
          • oldValue: In

          Returns State

    • ret: ((state) => Return)
        • (state): Return
        • Parameters

          • state: State

          Returns Return

    Returns FoldIndex<In, State, Return>

Properties

add: ((state, value) => State)

Type declaration

    • (state, value): State
    • Parameters

      • state: State
      • value: In

      Returns State

del: ((state, oldValue) => State)

Type declaration

    • (state, oldValue): State
    • Parameters

      • state: State
      • oldValue: In

      Returns State

ret: ((state) => Return)

Type declaration

    • (state): Return
    • Parameters

      • state: State

      Returns Return

state: State
update: ((state, oldValue, newValue) => State)

Type declaration

    • (state, oldValue, newValue): State
    • Parameters

      • state: State
      • oldValue: In
      • newValue: In

      Returns State

Methods

  • Parameters

    • update: Update<In>

    Returns (() => void)

      • (): void
      • Returns void

  • Type Parameters

    • In

    • State

    • Return

    Parameters

    • args: {
          add: ((state, value) => State);
          delete: ((state, oldValue) => State);
          init: State;
          result: ((state) => Return);
          update: ((state, oldValue, newValue) => State);
      }
      • add: ((state, value) => State)
          • (state, value): State
          • Parameters

            • state: State
            • value: In

            Returns State

      • delete: ((state, oldValue) => State)
          • (state, oldValue): State
          • Parameters

            • state: State
            • oldValue: In

            Returns State

      • init: State
      • result: ((state) => Return)
          • (state): Return
          • Parameters

            • state: State

            Returns Return

      • update: ((state, oldValue, newValue) => State)
          • (state, oldValue, newValue): State
          • Parameters

            • state: State
            • oldValue: In
            • newValue: In

            Returns State

    Returns UnregisteredAggregateIndex<In, Return>

Generated using TypeDoc