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

Method run

packages/sql/pg/src/PgClient.ts:666–683  ·  view source on GitHub ↗
(query: string, params: ReadonlyArray<unknown>)

Source from the content-addressed store, hash-verified

664 private readonly reserve: Effect.Effect<Pg.ClientBase, SqlError, Scope.Scope>
665
666 private run(query: string, params: ReadonlyArray<unknown>) {
667 return this.runWithClient<ReadonlyArray<any>>((client, resume) => {
668 client.query(query, params as any, (err, result) => {
669 if (err) {
670 resume(
671 Effect.fail(new SqlError({ reason: classifyError(err, "Failed to execute statement", "execute") }))
672 )
673 } else {
674 // Multi-statement queries return an array of results
675 resume(Effect.succeed(
676 Array.isArray(result)
677 ? result.map((r) => r.rows ?? [])
678 : result.rows ?? []
679 ))
680 }
681 })
682 })
683 }
684
685 execute(
686 sql: string,

Callers 9

executeMethod · 0.95
Client.test.tsFile · 0.45
runStatementFunction · 0.45
runStatementValuesFunction · 0.45
Client.test.tsFile · 0.45
makeFunction · 0.45

Calls 5

classifyErrorFunction · 0.70
resumeFunction · 0.50
failMethod · 0.45
succeedMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected