forked from tursodatabase/embedded-replica-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpire.ts
More file actions
21 lines (17 loc) · 631 Bytes
/
Copy pathexpire.ts
File metadata and controls
21 lines (17 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { createClient } from "@libsql/client";
import { prettyPrintDuration } from "./utils.ts"
if (process.env.DB_URL === undefined) {
throw new Error("DB_URL must be set");
}
if (process.env.AUTH_TOKEN === undefined) {
throw new Error("AUTH_TOKEN must be set");
}
const client = createClient({
url: process.env.DB_URL,
authToken: process.env.AUTH_TOKEN,
syncUrl: process.env.SYNC_URL,
});
const start = Bun.nanoseconds();
const rs = await client.execute("UPDATE keycards SET EXPIRED = 1 WHERE user_id = 1");
const delta = (Bun.nanoseconds() - start) / 1000;
console.log(`Expired in ${prettyPrintDuration(delta)}`);