MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / prepare

Function prepare

apps/host-cloudflare/src/db/d1.test.ts:25–40  ·  view source on GitHub ↗
(sql: string)

Source from the content-addressed store, hash-verified

23 }
24 };
25 const prepare = (sql: string) => {
26 const statement = (args: readonly unknown[]): Record<string, unknown> => ({
27 bind: (...values: readonly unknown[]) => statement([...args, ...values]),
28 all: async () => {
29 record(sql);
30 const result = await client.execute({ sql, args });
31 return { success: true, meta: {}, results: result.rows };
32 },
33 run: async () => {
34 record(sql);
35 await client.execute({ sql, args });
36 return { success: true, meta: {}, results: [] };
37 },
38 });
39 return statement([]);
40 };
41
42 // oxlint-disable-next-line executor/no-double-cast -- test double: only the D1 methods used by schema preparation and migrations are implemented
43 const db = {

Callers

nothing calls this directly

Calls 1

statementFunction · 0.70

Tested by

no test coverage detected