Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Database<StoreMap>

Type parameters

Hierarchy

  • Database

Index

Constructors

constructor

  • new Database<StoreMap>(db: IDBDatabase, stores: StoreMap): Database<StoreMap>
  • Type parameters

    Parameters

    • db: IDBDatabase
    • stores: StoreMap

    Returns Database<StoreMap>

Methods

exportDatabase

  • exportDatabase(): Promise<any>
  • Returns Promise<any>

get

  • get<N, S>(store: S, key: IDBValidKey): Promise<undefined | StoreContent<S>>
  • Type parameters

    • N: string | number | symbol

    • S: Store<any, any, S>

    Parameters

    • store: S
    • key: IDBValidKey

    Returns Promise<undefined | StoreContent<S>>

getIndexed

  • getIndexed<Ind>(index: Ind, key: IDBValidKey): Promise<undefined | IndexRecord<Ind>>
  • Type parameters

    • Ind: Index<string, string, any, any, Ind>

    Parameters

    • index: Ind
    • key: IDBValidKey

    Returns Promise<undefined | IndexRecord<Ind>>

importDatabase

  • importDatabase(dump: any): Promise<void>
  • Parameters

    • dump: any

    Returns Promise<void>

iter

  • iter<N, T>(store: Store<N, T>): ResultStream<T>
  • Type parameters

    • N: string

    • T

    Parameters

    Returns ResultStream<T>

iterIndex

  • iterIndex<Ind>(index: InferIndex<Ind>, query?: any): ResultStream<IndexRecord<Ind>>
  • Type parameters

    • Ind: Index<string, string, any, any, Ind>

    Parameters

    • index: InferIndex<Ind>
    • Optional query: any

    Returns ResultStream<IndexRecord<Ind>>

mutate

  • mutate<N, T>(store: Store<N, T>, key: IDBValidKey, f: (x: T) => undefined | T): Promise<void>
  • Type parameters

    • N: string

    • T

    Parameters

    • store: Store<N, T>
    • key: IDBValidKey
    • f: (x: T) => undefined | T
        • (x: T): undefined | T
        • Parameters

          • x: T

          Returns undefined | T

    Returns Promise<void>

put

  • put<St>(store: St, value: StoreContent<St>, key?: string | number | ArrayBuffer | Date | ArrayBufferView | IDBArrayKey): Promise<any>
  • Type parameters

    • St: Store<string, any, St>

    Parameters

    • store: St
    • value: StoreContent<St>
    • Optional key: string | number | ArrayBuffer | Date | ArrayBufferView | IDBArrayKey

    Returns Promise<any>

runWithReadTransaction

  • runWithReadTransaction<T, N, StoreTypes>(stores: StoreTypes[], f: (t: TransactionHandle<StoreTypes>) => Promise<T>): Promise<T>
  • Type parameters

    • T

    • N: string | number | symbol

    • StoreTypes: Store<any, any, StoreTypes>

    Parameters

    Returns Promise<T>

runWithWriteTransaction

  • runWithWriteTransaction<T, N, StoreTypes>(stores: StoreTypes[], f: (t: TransactionHandle<StoreTypes>) => Promise<T>): Promise<T>
  • Type parameters

    • T

    • N: string | number | symbol

    • StoreTypes: Store<any, any, StoreTypes>

    Parameters

    Returns Promise<T>

Static deleteDatabase

  • deleteDatabase(idbFactory: IDBFactory, dbName: string): void
  • Parameters

    • idbFactory: IDBFactory
    • dbName: string

    Returns void

Generated using TypeDoc