Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Store<Item>

A collection of items stored in the database.

Type parameters

  • Item: Storable

    The type of objects contained in this store.

Hierarchy

  • Store

Index

Properties

Accessors

Methods

Properties

Readonly by

by: unknown

Gives access to the store indexes.

The type is unknown because the type should be given by the user-defined $$ type.

See Example.

Accessors

name

Methods

add

  • add(item: Item): Promise<void>
  • Add an item to the store.

    Parameters

    • item: Item

    Returns Promise<void>

addIndex

  • addIndex<Trait>(indexName: string, traitPathOrGetter: string | ((item: Item) => Trait), options?: undefined | { explode?: undefined | false | true; unique?: undefined | false | true }): Promise<Index<Item, Trait>>
  • Add an index to the store.

    Only possible in a migration; see Versioning.

    Type parameters

    Parameters

    • indexName: string

      The name to give the new index

    • traitPathOrGetter: string | ((item: Item) => Trait)
    • Optional options: undefined | { explode?: undefined | false | true; unique?: undefined | false | true }

    Returns Promise<Index<Item, Trait>>

clear

  • clear(): Promise<void>
  • Remove all items from the store.

    Returns Promise<void>

count

  • count(): Promise<number>
  • Calculate the number of items in the store

    Returns Promise<number>

removeIndex

  • removeIndex(name: string): Promise<void>
  • Remove an index from the store

    Only possible in a migration; see Versioning.

    Parameters

    • name: string

    Returns Promise<void>

selectAll

Generated using TypeDoc