Skip to content

InMemoryReadModelStore

API reference for InMemoryReadModelStore

@delta-base/toolkit


In-memory implementation of the IReadModelStore interface Useful for testing and development

new InMemoryReadModelStore(): InMemoryReadModelStore

InMemoryReadModelStore

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

IReadModelStore.batchDelete


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

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<object[]>

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

IReadModelStore.batchGet


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

IReadModelStore.batchPut


clear(): void

Clear all data (useful for testing)

void


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

IReadModelStore.delete


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

IReadModelStore.get


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

Retrieves all values, optionally filtered by a key prefix.

T = unknown

QueryOptions

Optional settings for retrieving all values

Promise<object[]>

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

IReadModelStore.getAll


getCapabilities(): StoreCapabilities

Returns the capabilities of this store implementation

StoreCapabilities

Store capabilities object

IReadModelStore.getCapabilities


getNativeClient<C>(): C

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

C = Map<string, unknown>

C

The native client instance

IReadModelStore.getNativeClient


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

IReadModelStore.listKeys


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

IReadModelStore.put


query<T>(options): Promise<object[]>

Query items using filter criteria or options

T = unknown

QueryOptions & object

Query options and filter criteria

Promise<object[]>

A promise that resolves with matching items

IReadModelStore.query