2024-01-13 00:44:25 +08:00
|
|
|
import { KV, KvKey, KvQuery } from "$sb/types.ts";
|
2023-09-04 03:15:17 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the data store class you'll actually want to use, wrapping the primitives
|
|
|
|
* in a more user-friendly way
|
|
|
|
*/
|
2024-01-13 00:44:25 +08:00
|
|
|
export interface DataStore {
|
2024-01-12 00:12:04 +08:00
|
|
|
get<T = any>(key: KvKey): Promise<T | null>;
|
|
|
|
batchGet<T = any>(keys: KvKey[]): Promise<(T | null)[]>;
|
|
|
|
set(key: KvKey, value: any): Promise<void>;
|
|
|
|
batchSet<T = any>(entries: KV<T>[]): Promise<void>;
|
|
|
|
delete(key: KvKey): Promise<void>;
|
|
|
|
batchDelete(keys: KvKey[]): Promise<void>;
|
|
|
|
query<T = any>(query: KvQuery): Promise<KV<T>[]>;
|
|
|
|
queryDelete(query: KvQuery): Promise<void>;
|
|
|
|
}
|