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

Function withConnectionSpan

packages/effect/src/unstable/sql/Statement.ts:1285–1305  ·  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

1283 )
1284 },
1285 withConnectionSpan<XA, E>(
1286 this: StatementImpl<any>,
1287 operation: string,
1288 f: (
1289 connection: Connection,
1290 sql: string,
1291 params: ReadonlyArray<unknown>
1292 ) => Effect.Effect<XA, E>,
1293 withoutTransform: boolean,
1294 span: Tracer.Span
1295 ): Effect.Effect<XA, E | SqlError> {
1296 return withStatement(this, span, (statement) => {
1297 const [sql, params] = statement.compile(withoutTransform)
1298 for (const [key, value] of this.spanAttributes) {
1299 span.attribute(key, value)
1300 }
1301 span.attribute(ATTR_DB_OPERATION_NAME, operation)
1302 span.attribute(ATTR_DB_QUERY_TEXT, sql)
1303 return Effect.scoped(Effect.flatMap(this.acquirer, (_) => f(_, sql, params)))
1304 })
1305 },
1306
1307 get withoutTransform(): Effect.Effect<ReadonlyArray<any>, SqlError> {
1308 return this.withConnection(

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected