summaryrefslogtreecommitdiff
path: root/nodejs/database
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--nodejs/database/agents.ts20
1 files changed, 0 insertions, 20 deletions
diff --git a/nodejs/database/agents.ts b/nodejs/database/agents.ts
deleted file mode 100644
index 5221dc7..0000000
--- a/nodejs/database/agents.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { Agent } from '../lib/types.ts';
-import { DbData, db } from './db.ts';
-
-const addAgentStatement = db.prepare(`INSERT INTO agents(data) VALUES (json(?));`);
-const getAgentStatement = db.prepare(`SELECT data FROM agents;`);
-const setAgentStatement = db.prepare(`UPDATE agents SET data = json(?);`);
-
-export function addAgent(agent: Agent): void {
- addAgentStatement.run(JSON.stringify(agent));
-}
-
-export function getAgent(): Agent|null {
- const data = getAgentStatement.get() as DbData|undefined;
- if (!data) return null;
- return JSON.parse(data.data);
-}
-
-export function setAgent(agent: Agent): void {
- setAgentStatement.run(JSON.stringify(agent));
-}