Options
All
  • Public
  • Public/Protected
  • All
Menu

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

param db

The connected NEDB database instance

Hierarchy

Index

Constructors

constructor

Properties

Readonly db

db: Nedb<any>

Methods

convertTo

  • convertTo<T, O>(func: (input: T) => O): (doc: T) => O
  • Convenience method to convert a document to something.

    Type parameters

    • T

    • O

    Parameters

    • func: (input: T) => O

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

        • (input: T): O
        • Parameters

          • input: T

          Returns O

    Returns (doc: T) => O

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

      • (doc: T): O
      • Parameters

        • doc: T

        Returns O

delete

  • delete(query: Query): Promise<number>

getEntryByMatrixId

  • getEntryByMatrixId(roomId: string, eventId: string): Promise<null | StoredEvent>
  • 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.

getEntryByRemoteId

  • getEntryByRemoteId(roomId: string, eventId: string): Promise<null | StoredEvent>
  • 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

  • insert(objects: unknown): Promise<any[]>

insertIfNotExists

  • insertIfNotExists(query: Query, insertObj: Record<string, unknown>): Promise<void>

removeEvent

removeEventByMatrixId

  • removeEventByMatrixId(roomId: string, eventId: string): 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>

removeEventByRemoteId

  • removeEventByRemoteId(roomId: string, eventId: string): 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

  • select<T, O>(query: Query, transformFn?: (input: T) => O): Promise<O[]>

selectOne

  • selectOne<T, O>(query: Query, transformFn?: (input: T) => O): Promise<null | O>

setUnique

  • setUnique(fieldName: string, sparse?: boolean): void
  • 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

  • update(query: Query, updateVals: Record<string, unknown>): Promise<void>

upsert

  • upsert<T>(query: Query, updateVals: T): Promise<void>

upsertEvent

Generated using TypeDoc