Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Selection<Item, Trait>

Represents a selection of a bunch of items from a Store.

Type parameters

Hierarchy

  • Selection

Index

Methods

[Symbol.asyncIterator]

  • [Symbol.asyncIterator](): AsyncIterator<Item>
  • Asynchronously iterate over the selected items

    Returns AsyncIterator<Item>

array

  • array(): Promise<Array<Item>>
  • Return all selected items as an array.

    Returns Promise<Array<Item>>

count

  • count(): Promise<number>
  • Calculate the number of selected items.

    Returns Promise<number>

delete

  • delete(): Promise<void>
  • Delete the selected items from the database.

    Returns Promise<void>

drop

  • drop(count: number): this
  • Drop count items off of the beginning of a selection

    Parameters

    • count: number

    Returns this

filter

  • filter(...predicates: Array<(item: Item) => boolean>): this
  • Filter the selection

    Parameters

    • Rest ...predicates: Array<(item: Item) => boolean>

    Returns this

isEmpty

  • isEmpty(): Promise<boolean>
  • Test if the selection is empty or not.

    Returns Promise<boolean>

limit

  • limit(count: number): this
  • Limit the selection to at most count items

    Parameters

    • count: number

    Returns this

replace

  • replace(mapper: (item: Item) => Item): Promise<void>
  • Replace all selected items with the result of passing them into the given callback.

    Parameters

    • mapper: (item: Item) => Item
        • (item: Item): Item
        • Parameters

          • item: Item

          Returns Item

    Returns Promise<void>

update

  • update(delta: Partial<Item>): Promise<void>
  • Update all selected items with the given delta.

    Parameters

    • delta: Partial<Item>

    Returns Promise<void>

Generated using TypeDoc