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

Function control

packages/effect/src/sql/SqlClient.ts:755–766  ·  view source on GitHub ↗
(operation: string, effect: Effect.Effect<void, SqlError>)

Source from the content-addressed store, hash-verified

753 // Runs a transaction control in a span of its own, so a failure ends
754 // that span with the control's own exit.
755 const control = (operation: string, effect: Effect.Effect<void, SqlError>) =>
756 Effect.useSpan(
757 target === undefined ? operation : `${operation} ${target}`,
758 { kind: "client", parent: span },
759 (controlSpan) => {
760 for (const [key, value] of options.spanAttributes) {
761 controlSpan.attribute(key, value)
762 }
763 controlSpan.attribute(ATTR_DB_OPERATION_NAME, operation)
764 return effect
765 }
766 )
767 const connOption = Context.getOption(services, options.transactionService)
768 const conn: Effect.Effect<readonly [Scope.Closeable | undefined, S], SqlError> = connOption._tag === "Some"
769 // Checked under the savepoint permit: the parent can end while we wait.

Callers 4

SqlClient.tsFile · 0.70
startFunction · 0.70
makeWithTransactionFunction · 0.70
Workflow.test.tsFile · 0.50

Calls 1

attributeMethod · 0.65

Tested by

no test coverage detected