KV

Constructors

Methods

  • Type Parameters

    • Value = unknown

    Returns AsyncIterableIterator<{ key: KvKey; value: Value }, any, any>

  • Returns Promise<void>

  • Type Parameters

    • T = unknown

    Parameters

    Returns Promise<undefined | T>

  • Retrieve a list of keys in the database

    Each list operation must specify a selector which is used to specify the range of keys to return. The selector can either be a prefix selector, or a range selector:

    • A prefix selector selects all keys that start with the given prefix of key parts. For example, the selector ["users"] will select all keys that start with the prefix ["users"], such as ["users", "alice"] and ["users", "bob"]. Note that you can not partially match a key part, so the selector ["users", "a"] will not match the key ["users", "alice"]. A prefix selector may specify a start key that is used to skip over keys that are lexicographically less than the start key.

    • A range selector selects all keys that are lexicographically between the given start and end keys (including the start, and excluding the end). For example, the selector ["users", "a"], ["users", "n"] will select all keys that start with the prefix ["users"] and have a second key part that is lexicographically between a and n, such as ["users", "alice"], ["users", "bob"], and ["users", "mike"], but not ["users", "noa"] or ["users", "zoe"].

    Type Parameters

    • Value

    Parameters

    Returns KvListIterator<KvEntry<Value>>

  • Type Parameters

    • T = unknown

    Parameters

    • key: KvKey

      Key to watch

    • callback: (newValue?: T, oldValue?: T) => void
    • Optionalonce: boolean

    Returns () => void