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

Method executeStream

packages/sql/pg/src/PgClient.ts:493–504  ·  view source on GitHub ↗
(
    sql: string,
    params: ReadonlyArray<unknown>,
    transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined
  )

Source from the content-addressed store, hash-verified

491 )
492 }
493 executeStream(
494 sql: string,
495 params: ReadonlyArray<unknown>,
496 transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined
497 ) {
498 const stream = this.streamAcquirer === undefined
499 ? this.connection.stream(sql, params)
500 : Stream.unwrap(Effect.map(this.streamAcquirer, (connection) => connection.stream(sql, params)))
501 return transformRows
502 ? Stream.mapArray(stream, (rows) => transformRows(rows) as Arr.NonEmptyReadonlyArray<PgConnection.Row>)
503 : stream
504 }
505}
506
507/** PostgreSQL returns `ROLLBACK` for `COMMIT` when a transaction is aborted. */

Callers 1

streamFunction · 0.45

Calls 2

streamMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected