(
operation: string,
f: (
connection: Connection.Connection,
sql: string,
params: ReadonlyArray<unknown>
) => Effect.Effect<XA, E>,
withoutTransform = false
)
| 106 | } |
| 107 | |
| 108 | private withConnection<XA, E>( |
| 109 | operation: string, |
| 110 | f: ( |
| 111 | connection: Connection.Connection, |
| 112 | sql: string, |
| 113 | params: ReadonlyArray<unknown> |
| 114 | ) => Effect.Effect<XA, E>, |
| 115 | withoutTransform = false |
| 116 | ): Effect.Effect<XA, E | Error.SqlError> { |
| 117 | return Effect.useSpan( |
| 118 | "sql.execute", |
| 119 | { kind: "client", captureStackTrace: false }, |
| 120 | (span) => |
| 121 | withStatement(this, span, (statement) => { |
| 122 | const [sql, params] = statement.compile(withoutTransform) |
| 123 | for (const [key, value] of this.spanAttributes) { |
| 124 | span.attribute(key, value) |
| 125 | } |
| 126 | span.attribute(ATTR_DB_OPERATION_NAME, operation) |
| 127 | span.attribute(ATTR_DB_QUERY_TEXT, sql) |
| 128 | return Effect.scoped(Effect.flatMap(this.acquirer, (_) => f(_, sql, params))) |
| 129 | }) |
| 130 | ) |
| 131 | } |
| 132 | |
| 133 | get withoutTransform(): Effect.Effect<ReadonlyArray<A>, Error.SqlError> { |
| 134 | return this.withConnection( |
no test coverage detected