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

Function withConnectionSpan

packages/effect/src/sql/Statement.ts:1512–1532  ·  view source on GitHub ↗
(
    this: StatementImpl<any>,
    operation: string,
    f: (
      connection: Connection,
      sql: string,
      params: ReadonlyArray<unknown>
    ) => Effect.Effect<XA, E>,
    withoutTransform: boolean,
    span: Tracer.Span
  )

Source from the content-addressed store, hash-verified

1510 )
1511 },
1512 withConnectionSpan<XA, E>(
1513 this: StatementImpl<any>,
1514 operation: string,
1515 f: (
1516 connection: Connection,
1517 sql: string,
1518 params: ReadonlyArray<unknown>
1519 ) => Effect.Effect<XA, E>,
1520 withoutTransform: boolean,
1521 span: Tracer.Span
1522 ): Effect.Effect<XA, E | SqlError> {
1523 return withStatement(this, span, (statement, fiber) => {
1524 const [sql, params] = statement.compile(withoutTransform)
1525 for (const [key, value] of this.spanAttributes) {
1526 span.attribute(key, value)
1527 }
1528 span.attribute(ATTR_SQL_METHOD, operation)
1529 span.attribute(ATTR_DB_QUERY_TEXT, sql)
1530 return runOnConnection(fiber, span, this.acquirer, this.borrower, (connection) => f(connection, sql, params))
1531 })
1532 },
1533
1534 get withoutTransform(): Effect.Effect<ReadonlyArray<any>, SqlError> {
1535 return this.withConnection(

Callers

nothing calls this directly

Calls 5

withStatementFunction · 0.85
runOnConnectionFunction · 0.85
compileMethod · 0.80
attributeMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected