MCPcopy Create free account
hub / github.com/effect-app/libs / run

Function run

repos/effect/packages/sql/sqlite-react-native/src/SqliteClient.ts:144–167  ·  view source on GitHub ↗
(
        sql: string,
        params: ReadonlyArray<unknown> = [],
        values = false
      )

Source from the content-addressed store, hash-verified

142 yield* Effect.addFinalizer(() => Effect.sync(() => db.close()))
143
144 const run = (
145 sql: string,
146 params: ReadonlyArray<unknown> = []
147 ) =>
148 Effect.withFiber<Array<any>, SqlError>((fiber) => {
149 if (fiber.getRef(AsyncQuery)) {
150 return Effect.map(
151 Effect.tryPromise({
152 try: () => db.execute(sql, params as Array<any>),
153 catch: (cause) =>
154 new SqlError({ reason: classifyError(cause, "Failed to execute statement (async)", "execute") })
155 }),
156 (result) => result.rows
157 )
158 }
159 return Effect.try({
160 try: () => db.executeSync(sql, params as Array<any>).rows,
161 catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
162 })
163 })
164
165 const runValues = (
166 sql: string,
167 params: ReadonlyArray<unknown> = []
168 ) =>
169 Effect.withFiber<Array<any>, SqlError>((fiber) => {
170 if (fiber.getRef(AsyncQuery)) {

Callers 5

layerFunction · 0.70
executeFunction · 0.70
executeRawFunction · 0.70
executeValuesFunction · 0.70
executeValuesUnpreparedFunction · 0.70

Calls 4

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

Tested by

no test coverage detected