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

Function queryTextValues

packages/sql/pg/src/PgClient.ts:397–416  ·  view source on GitHub ↗
(sql: string, params?: ReadonlyArray<unknown>)

Source from the content-addressed store, hash-verified

395
396 // Routed and traced as a statement is, without the connection wait time.
397 const queryTextValues = (sql: string, params?: ReadonlyArray<unknown>) =>
398 Effect.withFiber((fiber) =>
399 Effect.useSpan(fiber.getRef(Statement.SpanNameGenerator)(spanAttributes), { kind: "client" }, (span) => {
400 for (const [key, value] of spanAttributes) {
401 span.attribute(key, value)
402 }
403 span.attribute(ATTR_SQL_METHOD, "executeTextValues")
404 span.attribute(ATTR_DB_QUERY_TEXT, sql)
405 const run = (connection: Connection) => (connection as ConnectionImpl).connection.queryTextValues(sql, params)
406 const transaction = Context.getOrUndefined(fiber.context, client.transactionService)
407 const execute = transaction !== undefined
408 ? Effect.flatMap(Client.activeTransactionConnection(transaction), run)
409 : borrower !== undefined
410 ? borrower(run)
411 : Effect.scoped(Effect.flatMap(acquirer, run))
412 return fiber.cache.tracerEnabled && fiber.getRef(Statement.SpanPropagationEnabled)
413 ? Effect.provideService(execute, Tracer.ParentSpan, span)
414 : execute
415 })
416 )
417
418 return Object.assign(
419 client,

Callers

nothing calls this directly

Calls 2

getRefMethod · 0.80
attributeMethod · 0.65

Tested by

no test coverage detected