Back
Version 63
5/29/2024
import { InStatement, sqlite as std_sqlite } from "https://esm.town/v/std/sqlite?v=4";
import { Client, createClient, ResultSet, Transaction, TransactionMode } from "npm:@libsql/client";
import { afterBatch, beforeBatch, withLibsqlHooks } from "npm:libsql-client-hooks";
class CustomClient implements Client {
execute(stmt: InStatement): Promise<ResultSet> {
return std_sqlite.execute(stmt);
}
batch(stmts: Array<InStatement>, mode?: TransactionMode): Promise<Array<ResultSet>> {
return std_sqlite.batch(stmts, mode);
}
transaction(mode?: TransactionMode): Promise<Transaction>;
executeMultiple(sql: string): Promise<void>;
sync(): Promise<void>;
close(): void;
closed: boolean = false;
protocol: string = "http";
}
const client = createClient({
url: Deno.env.get("TURSO_LINGBUZZ_URL"),
authToken: Deno.env.get("TURSO_LINGBUZZ_TOKEN"),
});
const logAfterExecute = afterBatch((results, stmts) => {
const output = stmts.map((s, i) => {
const r = results[i].toJSON().rows[0][0];
return { query: s, result: r };
f;
Updated: May 29, 2024