Complete redo of content indexing and querying (#517)
Complete redo of data store Introduces live queries and live templates
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
export * as asset from "./asset.ts";
|
||||
export * as events from "./event.ts";
|
||||
export * as shell from "./shell.ts";
|
||||
export * as store from "./store.ts";
|
||||
export * as YAML from "./yaml.ts";
|
||||
export * as mq from "./mq.ts";
|
||||
export * from "./syscall.ts";
|
||||
export * as datastore from "./datastore.ts";
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
import { syscall } from "./syscall.ts";
|
||||
|
||||
export type KV = {
|
||||
key: string;
|
||||
value: any;
|
||||
};
|
||||
|
||||
export type Query = {
|
||||
filter?: Filter[];
|
||||
orderBy?: string;
|
||||
orderDesc?: boolean;
|
||||
limit?: number;
|
||||
select?: string[];
|
||||
};
|
||||
|
||||
export type Filter = {
|
||||
op: string;
|
||||
prop: string;
|
||||
value: any;
|
||||
};
|
||||
|
||||
export function set(key: string, value: any): Promise<void> {
|
||||
return syscall("store.set", key, value);
|
||||
}
|
||||
|
||||
export function batchSet(kvs: KV[]): Promise<void> {
|
||||
return syscall("store.batchSet", kvs);
|
||||
}
|
||||
|
||||
export function get(key: string): Promise<any> {
|
||||
return syscall("store.get", key);
|
||||
}
|
||||
|
||||
export function batchGet(keys: string[]): Promise<(any | undefined)[]> {
|
||||
return syscall("store.batchGet", keys);
|
||||
}
|
||||
|
||||
export function has(key: string): Promise<boolean> {
|
||||
return syscall("store.has", key);
|
||||
}
|
||||
|
||||
export function del(key: string): Promise<void> {
|
||||
return syscall("store.delete", key);
|
||||
}
|
||||
|
||||
export function batchDel(keys: string[]): Promise<void> {
|
||||
return syscall("store.batchDelete", keys);
|
||||
}
|
||||
|
||||
export function queryPrefix(
|
||||
prefix: string,
|
||||
): Promise<{ key: string; value: any }[]> {
|
||||
return syscall("store.queryPrefix", prefix);
|
||||
}
|
||||
|
||||
export function deletePrefix(prefix: string): Promise<void> {
|
||||
return syscall("store.deletePrefix", prefix);
|
||||
}
|
||||
|
||||
export function deleteAll(): Promise<void> {
|
||||
return syscall("store.deleteAll");
|
||||
}
|
||||
Reference in New Issue
Block a user