Polkadot Apps
    Preparing search index...

    Interface Collection<T, Key>

    interface Collection<T = any, Key = any> {
        db: Dexie;
        and(filter: (x: T) => boolean): Collection<T, Key, T>;
        clone(props?: Object): Collection<T, Key, T>;
        count(): PromiseExtended<number>;
        count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
        delete(): PromiseExtended<number>;
        distinct(): Collection<T, Key, T>;
        each(
            callback: (
                obj: T,
                cursor: { key: IndexableType; primaryKey: Key },
            ) => any,
        ): PromiseExtended<void>;
        eachKey(
            callback: (
                key: IndexableType,
                cursor: { key: IndexableType; primaryKey: Key },
            ) => any,
        ): PromiseExtended<void>;
        eachPrimaryKey(
            callback: (
                key: Key,
                cursor: { key: IndexableType; primaryKey: Key },
            ) => any,
        ): PromiseExtended<void>;
        eachUniqueKey(
            callback: (
                key: IndexableType,
                cursor: { key: IndexableType; primaryKey: Key },
            ) => any,
        ): PromiseExtended<void>;
        filter<S>(filter: (x: T) => x is S): Collection<S, Key>;
        filter(filter: (x: T) => boolean): Collection<T, Key, T>;
        first(): PromiseExtended<T | undefined>;
        first<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
        firstKey(): PromiseExtended<IndexableType | undefined>;
        keys(): PromiseExtended<IndexableTypeArray>;
        keys<R>(
            thenShortcut: ThenShortcut<IndexableTypeArray, R>,
        ): PromiseExtended<R>;
        last(): PromiseExtended<T | undefined>;
        last<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
        lastKey(): PromiseExtended<IndexableType | undefined>;
        limit(n: number): Collection<T, Key, T>;
        modify(
            changeCallback: (obj: T, ctx: { value: T }) => boolean | void,
        ): PromiseExtended<number>;
        modify(changes: UpdateSpec<TInsertType>): PromiseExtended<number>;
        offset(n: number): Collection<T, Key, T>;
        or(indexOrPrimayKey: string): WhereClause<T, Key, T>;
        primaryKeys(): PromiseExtended<Key[]>;
        primaryKeys<R>(thenShortcut: ThenShortcut<Key[], R>): PromiseExtended<R>;
        raw(): Collection<T, Key, T>;
        reverse(): Collection<T, Key, T>;
        sortBy(keyPath: string): PromiseExtended<T[]>;
        sortBy<R>(
            keyPath: string,
            thenShortcut: ThenShortcut<T[], R>,
        ): PromiseExtended<R>;
        toArray(): PromiseExtended<T[]>;
        toArray<R>(thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
        uniqueKeys(): PromiseExtended<IndexableTypeArray>;
        uniqueKeys<R>(
            thenShortcut: ThenShortcut<IndexableTypeArray, R>,
        ): PromiseExtended<R>;
        until(
            filter: (value: T) => boolean,
            includeStopEntry?: boolean,
        ): Collection<T, Key, T>;
    }

    Type Parameters

    • T = any
    • Key = any

    Hierarchy

    • _Collection<T, Key>
      • Collection
    Index

    Properties

    db: Dexie

    Methods

    • Parameters

      • filter: (x: T) => boolean

      Returns Collection<T, Key, T>

    • Parameters

      • Optionalprops: Object

      Returns Collection<T, Key, T>

    • Returns PromiseExtended<number>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<number, R>

      Returns PromiseExtended<R>

    • Returns PromiseExtended<number>

    • Returns Collection<T, Key, T>

    • Parameters

      • callback: (obj: T, cursor: { key: IndexableType; primaryKey: Key }) => any

      Returns PromiseExtended<void>

    • Parameters

      • callback: (key: IndexableType, cursor: { key: IndexableType; primaryKey: Key }) => any

      Returns PromiseExtended<void>

    • Parameters

      • callback: (key: Key, cursor: { key: IndexableType; primaryKey: Key }) => any

      Returns PromiseExtended<void>

    • Parameters

      • callback: (key: IndexableType, cursor: { key: IndexableType; primaryKey: Key }) => any

      Returns PromiseExtended<void>

    • Type Parameters

      • S

      Parameters

      • filter: (x: T) => x is S

      Returns Collection<S, Key>

    • Parameters

      • filter: (x: T) => boolean

      Returns Collection<T, Key, T>

    • Returns PromiseExtended<T | undefined>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<T | undefined, R>

      Returns PromiseExtended<R>

    • Returns PromiseExtended<IndexableType | undefined>

    • Returns PromiseExtended<IndexableTypeArray>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<IndexableTypeArray, R>

      Returns PromiseExtended<R>

    • Returns PromiseExtended<T | undefined>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<T | undefined, R>

      Returns PromiseExtended<R>

    • Returns PromiseExtended<IndexableType | undefined>

    • Parameters

      • n: number

      Returns Collection<T, Key, T>

    • Parameters

      • changeCallback: (obj: T, ctx: { value: T }) => boolean | void

      Returns PromiseExtended<number>

    • Parameters

      • changes: UpdateSpec<TInsertType>

      Returns PromiseExtended<number>

    • Parameters

      • n: number

      Returns Collection<T, Key, T>

    • Parameters

      • indexOrPrimayKey: string

      Returns WhereClause<T, Key, T>

    • Returns PromiseExtended<Key[]>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<Key[], R>

      Returns PromiseExtended<R>

    • Returns Collection<T, Key, T>

    • Returns Collection<T, Key, T>

    • Parameters

      • keyPath: string

      Returns PromiseExtended<T[]>

    • Type Parameters

      • R

      Parameters

      • keyPath: string
      • thenShortcut: ThenShortcut<T[], R>

      Returns PromiseExtended<R>

    • Returns PromiseExtended<T[]>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<T[], R>

      Returns PromiseExtended<R>

    • Returns PromiseExtended<IndexableTypeArray>

    • Type Parameters

      • R

      Parameters

      • thenShortcut: ThenShortcut<IndexableTypeArray, R>

      Returns PromiseExtended<R>

    • Parameters

      • filter: (value: T) => boolean
      • OptionalincludeStopEntry: boolean

      Returns Collection<T, Key, T>