Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MemoryStorageEngine<T>

StorageEngine which uses a Map in the process memory space as a datasource

Type parameters

  • T

Hierarchy

Index

Methods

addToList

  • addToList(listId: string, id: string): void

filter

  • filter(fn: (value?: T, index?: number, array?: T[]) => unknown, ids: string[], namespace: string): T[]
  • Filter for an object

    Parameters

    • fn: (value?: T, index?: number, array?: T[]) => unknown

      filter function to use

        • (value?: T, index?: number, array?: T[]): unknown
        • Parameters

          • Optional value: T
          • Optional index: number
          • Optional array: T[]

          Returns unknown

    • ids: string[]

      array of ids that should be used for the filtering

    • namespace: string

      namespace of the filter

    Returns T[]

    filtered data

find

  • find(fn: (value?: T, index?: number, array?: string[]) => boolean, ids?: null | string[], namespace: string): null | T
  • Filter for an object and return after the first search success

    Parameters

    • fn: (value?: T, index?: number, array?: string[]) => boolean

      filter function to use

        • (value?: T, index?: number, array?: string[]): boolean
        • Parameters

          • Optional value: T
          • Optional index: number
          • Optional array: string[]

          Returns boolean

    • ids: null | string[] = null

      array of ids that should be used for the filtering

    • namespace: string

      namespace of the filter

    Returns null | T

    the first result or null if nothing was found

get

  • get(id: string): null | T
  • get(id: string, DO_NOT_USE_THIS_OVERLOAD?: unknown): string | Promise<string>

getListCount

  • getListCount(listId: string): number

getListMembers

  • getListMembers(listId: string): string[]

initialize

isListMember

  • isListMember(listId: string, id: string): boolean

Private parseData

  • parseData(data: undefined | null | string): null | T

Private prepareData

  • prepareData(data: T): string

remove

  • remove(id: string): void

removeFromList

  • removeFromList(listId: string, id: string): void

removeList

  • removeList(listId: string): void

upsert

  • upsert(id: string, updateData: T): void

Constructors

constructor

Properties

index

index: Map<string, string[]> = ...

map

map: Map<string, string> = ...

ready

ready: boolean

Generated using TypeDoc