stores
    Preparing search index...

    Interface Datastore<HasOptionsExtension, PutOptionsExtension, PutManyOptionsExtension, GetOptionsExtension, GetManyOptionsExtension, DeleteOptionsExtension, DeleteManyOptionsExtension, QueryOptionsExtension, QueryKeysOptionsExtension, BatchOptionsExtension>

    interface Datastore<
        HasOptionsExtension = {},
        PutOptionsExtension = {},
        PutManyOptionsExtension = {},
        GetOptionsExtension = {},
        GetManyOptionsExtension = {},
        DeleteOptionsExtension = {},
        DeleteManyOptionsExtension = {},
        QueryOptionsExtension = {},
        QueryKeysOptionsExtension = {},
        BatchOptionsExtension = {},
    > {
        batch(): Batch<BatchOptionsExtension>;
        delete(
            key: Key,
            options?: AbortOptions & DeleteOptionsExtension,
        ): void | Promise<void>;
        deleteMany(
            source: Iterable<Key, any, any> | AsyncIterable<Key, any, any>,
            options?: AbortOptions & DeleteManyOptionsExtension,
        ): Generator<Key, any, any> | AsyncGenerator<Key, any, any>;
        get(
            key: Key,
            options?: AbortOptions & GetOptionsExtension,
        ): Uint8Array<ArrayBufferLike> | Promise<Uint8Array<ArrayBufferLike>>;
        getMany(
            source: Iterable<Key, any, any> | AsyncIterable<Key, any, any>,
            options?: AbortOptions & GetManyOptionsExtension,
        ): Generator<Pair, any, any> | AsyncGenerator<Pair, any, any>;
        has(
            key: Key,
            options?: AbortOptions & HasOptionsExtension,
        ): boolean | Promise<boolean>;
        put(
            key: Key,
            val: Uint8Array,
            options?: AbortOptions & PutOptionsExtension,
        ): Key | Promise<Key>;
        putMany(
            source: Iterable<Pair, any, any> | AsyncIterable<Pair, any, any>,
            options?: AbortOptions & PutManyOptionsExtension,
        ): Generator<Key, any, any> | AsyncGenerator<Key, any, any>;
        query(
            query: Query,
            options?: AbortOptions & QueryOptionsExtension,
        ): Generator<Pair, any, any> | AsyncGenerator<Pair, any, any>;
        queryKeys(
            query: KeyQuery,
            options?: AbortOptions & QueryKeysOptionsExtension,
        ): Generator<Key, any, any> | AsyncGenerator<Key, any, any>;
    }

    Type Parameters

    • HasOptionsExtension = {}
    • PutOptionsExtension = {}
    • PutManyOptionsExtension = {}
    • GetOptionsExtension = {}
    • GetManyOptionsExtension = {}
    • DeleteOptionsExtension = {}
    • DeleteManyOptionsExtension = {}
    • QueryOptionsExtension = {}
    • QueryKeysOptionsExtension = {}
    • BatchOptionsExtension = {}

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • This will return an object with which you can chain multiple operations together, with them only being executed on calling commit.

      Returns Batch<BatchOptionsExtension>

      const b = store.batch()

      for (let i = 0; i < 100; i++) {
      b.put(new Key(`hello${i}`), new TextEncoder('utf8').encode(`hello world ${i}`))
      }

      await b.commit()
      console.log('put 100 values')
    • Check for the existence of a value for the passed key

      Parameters

      Returns boolean | Promise<boolean>

      const exists = await store.has(new Key('awesome'))

      if (exists) {
      console.log('it is there')
      } else {
      console.log('it is not there')
      }