MCPcopy Index your code
hub / github.com/Effect-TS/effect / run

Function run

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

Source from the content-addressed store, hash-verified

107 yield* Effect.addFinalizer(() => Effect.sync(() => db.close()))
108
109 const run = (
110 sql: string,
111 params: ReadonlyArray<unknown> = []
112 ) =>
113 Effect.withFiberRuntime<Array<any>, SqlError>((fiber) => {
114 if (fiber.getFiberRef(asyncQuery)) {
115 return Effect.map(
116 Effect.tryPromise({
117 try: () => db.executeAsync(sql, params as Array<any>),
118 catch: (cause) => new SqlError({ cause, message: "Failed to execute statement (async)" })
119 }),
120 (result) => result.rows?._array ?? []
121 )
122 }
123 return Effect.try({
124 try: () => db.execute(sql, params as Array<any>).rows?._array ?? [],
125 catch: (cause) => new SqlError({ cause, message: "Failed to execute statement" })
126 })
127 })
128
129 return identity<SqliteConnection>({
130 execute(sql, params, transformRows) {

Callers 4

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

Calls 3

getFiberRefMethod · 0.65
mapMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected