Support for store.has syscall

This commit is contained in:
Zef Hemel
2023-01-26 15:26:56 +01:00
parent bc8d2d5e61
commit d133c79de0
3 changed files with 12 additions and 0 deletions
+7
View File
@@ -135,6 +135,13 @@ export function storeSyscalls(
return null;
}
},
"store.has": async (_ctx, key: string): Promise<boolean> => {
const result = await db.query(
`SELECT count(value) as cnt FROM ${tableName} WHERE key = ?`,
key,
);
return result[0].cnt === 1;
},
"store.queryPrefix": async (_ctx, prefix: string) => {
return (
await db.query(