1
0
silverbullet/plug-api/plugos-syscall/datastore.ts
Zef Hemel 0313565610
Complete redo of content indexing and querying (#517)
Complete redo of data store
Introduces live queries and live templates
2023-10-03 14:16:33 +02:00

39 lines
962 B
TypeScript

import { syscall } from "$sb/plugos-syscall/syscall.ts";
import { KV, KvKey, KvQuery } from "$sb/types.ts";
export function set(key: KvKey, value: any): Promise<void> {
return syscall("datastore.set", key, value);
}
export function batchSet(kvs: KV[]): Promise<void> {
return syscall("datastore.batchSet", kvs);
}
export function get(key: KvKey): Promise<any> {
return syscall("datastore.get", key);
}
export function batchGet(keys: KvKey[]): Promise<(any | undefined)[]> {
return syscall("datastore.batchGet", keys);
}
export function del(key: KvKey): Promise<void> {
return syscall("datastore.delete", key);
}
export function batchDel(keys: KvKey[]): Promise<void> {
return syscall("datastore.batchDelete", keys);
}
export function query(
query: KvQuery,
): Promise<KV[]> {
return syscall("datastore.query", query);
}
export function queryDelete(
query: KvQuery,
): Promise<void> {
return syscall("datastore.queryDelete", query);
}