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

Function stream

packages/effect/src/sql/Statement.ts:1550–1575  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1548 },
1549
1550 get stream(): Stream.Stream<any, SqlError> {
1551 const self = this as StatementImpl<any>
1552 return Stream.unwrap(Effect.flatMap(
1553 Effect.withFiber((fiber) =>
1554 Effect.makeSpanScoped(fiber.getRef(SpanNameGenerator)(self.spanAttributes), { kind: "client" })
1555 ),
1556 (span) =>
1557 withStatement(self, span, (statement, fiber) => {
1558 const [sql, params] = statement.compile()
1559 for (const [key, value] of self.spanAttributes) {
1560 span.attribute(key, value)
1561 }
1562 span.attribute(ATTR_SQL_METHOD, "executeStream")
1563 span.attribute(ATTR_DB_QUERY_TEXT, sql)
1564 const propagate = fiber.cache.tracerEnabled && fiber.getRef(SpanPropagationEnabled)
1565 const clock = propagate ? waitClock(fiber) : undefined
1566 const acquire = Effect.map(self.acquirer, (connection) => {
1567 if (clock !== undefined) recordConnectionWait(span, clock)
1568 return connection.executeStream(sql, params, self.transformRows)
1569 })
1570 return propagate
1571 ? Effect.succeed(Stream.provideService(Stream.unwrap(acquire), Tracer.ParentSpan, span))
1572 : acquire
1573 })
1574 ))
1575 },
1576
1577 get values(): Effect.Effect<
1578 ReadonlyArray<ReadonlyArray<unknown>>,

Callers

nothing calls this directly

Calls 9

waitClockFunction · 0.90
recordConnectionWaitFunction · 0.90
withStatementFunction · 0.85
getRefMethod · 0.80
compileMethod · 0.80
attributeMethod · 0.65
mapMethod · 0.45
executeStreamMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected