MCPcopy Create free account
hub / github.com/anomalyco/opencode / run

Function run

packages/core/src/database/sqlite.bun.ts:56–70  ·  view source on GitHub ↗
(query: string, params: ReadonlyArray<unknown> = [])

Source from the content-addressed store, hash-verified

54 : undefined
55
56 const run = (query: string, params: ReadonlyArray<unknown> = []) =>
57 Effect.withFiber<Array<Record<string, unknown>>, SqlError>((fiber) => {
58 const statement = native.query(query)
59 // @ts-ignore bun-types missing safeIntegers method, fixed in https://github.com/oven-sh/bun/pull/26627
60 statement.safeIntegers(Context.get(fiber.context, Client.SafeIntegers))
61 try {
62 return Effect.succeed((statement.all(...(params as any)) ?? []) as Array<Record<string, unknown>>)
63 } catch (cause) {
64 return Effect.fail(
65 new SqlError({
66 reason: classifySqliteError(cause, { message: "Failed to execute statement", operation: "execute" }),
67 }),
68 )
69 }
70 })
71
72 const runValues = (query: string, params: ReadonlyArray<unknown> = []) =>
73 Effect.withFiber<Array<unknown[]>, SqlError>((fiber) => {

Callers 2

executeFunction · 0.70
executeRawFunction · 0.70

Calls 2

getMethod · 0.65
allMethod · 0.45

Tested by

no test coverage detected