Construct a store suitable for event mapping information. Data is stored as StoredEvents.

Param: db

The connected NEDB database instance

Hierarchy (view full)

Constructors

Properties

db: Nedb<any>

Methods

  • Convenience method to convert a document to something.

    Type Parameters

    • T

    • O

    Parameters

    • func: ((input) => O)

      The function which will be called with a single document object. Guaranteed not to be null.

        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns ((doc) => O)

    A transformFn function to pass to the standard select/delete/upsert/etc methods.

      • (doc): O
      • Parameters

        • doc: T

        Returns O

  • DELETE multiple documents.

    Parameters

    • query: Query

    Returns Promise<number>

  • Get an existing event based on the provided matrix IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<null | StoredEvent>

    A promise which resolves to the StoredEvent or null.

  • Get an existing event based on the provided remote IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<null | StoredEvent>

    A promise which resolves to the StoredEvent or null.

  • INSERT a multiple documents.

    Parameters

    • objects: unknown

    Returns Promise<any[]>

  • INSERT IF NOT EXISTS a single document

    Parameters

    • query: Query
    • insertObj: Record<string, unknown>

    Returns Promise<void>

  • Remove entries based on the event data.

    Parameters

    Returns Promise<number>

  • Remove entries based on the matrix IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<number>

  • Remove entries based on the matrix IDs.

    Parameters

    • roomId: string

      The ID of the room.

    • eventId: string

      The ID of the event.

    Returns Promise<number>

  • SELECT a number of documents.

    Type Parameters

    • T

    • O

    Parameters

    • query: Query
    • Optional transformFn: ((input) => O)
        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns Promise<O[]>

  • SELECT a single document.

    Type Parameters

    • T

    • O

    Parameters

    • query: Query
    • Optional transformFn: ((input) => O)
        • (input): O
        • Parameters

          • input: T

          Returns O

    Returns Promise<null | O>

  • Set a UNIQUE key constraint on the given field.

    Parameters

    • fieldName: string

      The field name. Use dot notation for nested objects.

    • sparse: boolean = false

      Allow sparse entries (undefined won't cause a key violation).

    Returns void

  • UPDATE a single document. If the document already exists, this will NOT update it.

    Parameters

    • query: Query
    • updateVals: Record<string, unknown>

    Returns Promise<void>

  • UPSERT a single document

    Type Parameters

    • T

    Parameters

    • query: Query
    • updateVals: T

    Returns Promise<void>

  • Insert an event, clobbering based on the ID of the StoredEvent.

    Parameters

    Returns Promise<void>

Generated using TypeDoc