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

Function run

packages/sql/sqlite-react-native/src/SqliteClient.ts:166–185  ·  view source on GitHub ↗
(
        sql: string,
        params: ReadonlyArray<unknown> = []
      )

Source from the content-addressed store, hash-verified

164 yield* Effect.addFinalizer(() => Effect.sync(() => db.close()))
165
166 const run = (
167 sql: string,
168 params: ReadonlyArray<unknown> = []
169 ) =>
170 Effect.withFiber<Array<any>, SqlError>((fiber) => {
171 if (fiber.getRef(AsyncQuery)) {
172 return Effect.map(
173 Effect.tryPromise({
174 try: () => db.execute(sql, params as Array<any>),
175 catch: (cause) =>
176 new SqlError({ reason: classifyError(cause, "Failed to execute statement (async)", "execute") })
177 }),
178 (result) => result.rows
179 )
180 }
181 return Effect.try({
182 try: () => db.executeSync(sql, params as Array<any>).rows,
183 catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
184 })
185 })
186
187 const runValues = (
188 sql: string,

Callers 3

layerFunction · 0.70
executeFunction · 0.70
executeRawFunction · 0.70

Calls 4

getRefMethod · 0.80
classifyErrorFunction · 0.70
mapMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected