Skip to content

IReadModelStore

API reference for IReadModelStore

@delta-base/toolkit


Core read model store interface compatible with multiple database types. Provides methods for storing, retrieving, deleting, and listing key-value pairs.

optional batchDelete(keys, options?): Promise<boolean[]>

Batch deletion of multiple items

string[]

Array of keys to delete

WriteOptions

Optional settings for the batch delete operation

Promise<boolean[]>

A promise that resolves with an array of booleans indicating success/failure


optional batchGet<T>(keys, options?): Promise<unknown[]>

Batch retrieval of multiple items by their keys

T = unknown

string[]

Array of keys to retrieve

ReadOptions

Optional settings for the batch get operation

Promise<unknown[]>

A promise that resolves with an array of key-value pairs


optional batchPut<T>(items, options?): Promise<void>

Batch storage of multiple items

T = unknown

object[]

Array of key-value pairs to store

WriteOptions & ExpirationOptions

Optional settings for the batch put operation

Promise<void>

A promise that resolves when all values have been stored


delete(key, options?): Promise<boolean>

Deletes a value by its key.

string

The key of the value to delete

WriteOptions

Optional settings for the delete operation

Promise<boolean>

A promise that resolves to true if the key existed and was deleted, false otherwise


get<T>(key, options?): Promise<null | T>

Retrieves a value by its key.

T = unknown

string

The key of the value to retrieve

ReadOptions

Optional settings for the retrieval operation

Promise<null | T>

A promise that resolves with the value, or null if not found


getAll<T>(options?): Promise<unknown[]>

Retrieves all values, optionally filtered by a key prefix.

T = unknown

QueryOptions

Optional settings for retrieving all values

Promise<unknown[]>

A promise that resolves with an array of key-value pairs


optional getCapabilities(): StoreCapabilities

Returns the capabilities of this store implementation

StoreCapabilities

Store capabilities object


optional getNativeClient<C>(): C

Gets access to the native database client Allows for direct operations using the underlying database API

C = unknown

C

The native client instance


optional listKeys(options?): Promise<{ cursor?: string; keys: object[]; list_complete: boolean; }>

Lists keys in the store, optionally filtered by prefix.

Optional settings for the list operation

string

number

string

string

Promise<{ cursor?: string; keys: object[]; list_complete: boolean; }>

A promise that resolves with the list result containing keys and metadata


put<T>(key, value, options?): Promise<void>

Stores a value with the given key. If the key already exists, the value will be overwritten.

T = unknown

string

The key under which to store the value

T

The value to store (string, ArrayBuffer, or any type that can be serialized to JSON)

WriteOptions & ExpirationOptions & MetadataOptions

Optional settings for the storage operation

Promise<void>

A promise that resolves when the value has been stored


optional query<T>(options): Promise<unknown[]>

Query items using filter criteria or options

T = unknown

QueryOptions & object

Query options and filter criteria

Promise<unknown[]>

A promise that resolves with matching items