MCPcopy Create free account
hub / github.com/Effect-TS/effect / runStatement

Function runStatement

packages/sql/d1/src/D1Client.ts:224–237  ·  view source on GitHub ↗
(
        statement: D1PreparedStatement,
        params: ReadonlyArray<unknown> = []
      )

Source from the content-addressed store, hash-verified

222 })
223
224 const runStatement = (
225 statement: D1PreparedStatement,
226 params: ReadonlyArray<unknown> = []
227 ): Effect.Effect<ReadonlyArray<any>, SqlError, never> =>
228 Effect.tryPromise({
229 try: async () => {
230 const response = await statement.bind(...params).all()
231 if (response.error) {
232 throw response.error
233 }
234 return response.results || []
235 },
236 catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
237 })
238
239 const runRaw = (
240 sql: string,

Callers 2

runRawFunction · 0.70
runCachedFunction · 0.70

Calls 2

allMethod · 0.80
classifyErrorFunction · 0.70

Tested by

no test coverage detected