MCPcopy Create free account
hub / github.com/effect-app/libs / statement

Function statement

repos/effect/packages/effect/src/unstable/sql/Statement.ts:617–644  ·  view source on GitHub ↗
(
  acquirer: Acquirer,
  compiler: Compiler,
  strings: TemplateStringsArray,
  args: Array<any>,
  spanAttributes: ReadonlyArray<readonly [string, unknown]>,
  transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined
)

Source from the content-addressed store, hash-verified

615
616 return self
617}
618
619const constructorCache = {
620 transforms: new WeakMap<Acquirer, Constructor>(),
621 noTransforms: new WeakMap<Acquirer, Constructor>()
622}
623
624/**
625 * Builds a `Statement` from template strings and arguments, preserving
626 * fragments and helper segments while converting ordinary interpolated values
627 * into bound parameters.
628 *
629 * @category constructors
630 * @since 4.0.0
631 */
632export const statement = <A = Row>(
633 acquirer: Acquirer,
634 compiler: Compiler,
635 strings: TemplateStringsArray,
636 args: Array<any>,
637 spanAttributes: ReadonlyArray<readonly [string, unknown]>,
638 transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined,
639 borrower?: Borrower | undefined
640): Statement<A> => {
641 const segments: Array<Segment> = strings[0].length > 0 ? [literal(strings[0])] : []
642
643 for (let i = 0; i < args.length; i++) {
644 const arg = args[i]
645
646 if (isFragment(arg)) {
647 segments.push(...arg.segments)

Callers 1

makeFunction · 0.70

Calls 6

isFragmentFunction · 0.85
isSegmentFunction · 0.85
parameterFunction · 0.85
pushMethod · 0.80
literalFunction · 0.70
makeUnsafeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…