MCPcopy
hub / github.com/prisma/prisma / bindSqlAdapterFactory

Function bindSqlAdapterFactory

packages/driver-adapter-utils/src/binder.ts:66–84  ·  view source on GitHub ↗
(
  adapterFactory: SqlDriverAdapterFactory,
)

Source from the content-addressed store, hash-verified

64}
65
66export const bindSqlAdapterFactory = (
67 adapterFactory: SqlDriverAdapterFactory,
68): ErrorCapturingSqlDriverAdapterFactory => {
69 const errorRegistry = new ErrorRegistryInternal()
70
71 const boundFactory: ErrorCapturingSqlDriverAdapterFactory = {
72 adapterName: adapterFactory.adapterName,
73 provider: adapterFactory.provider,
74 errorRegistry,
75 connect: async (...args) => {
76 const ctx = await wrapAsync(errorRegistry, adapterFactory.connect.bind(adapterFactory))(...args)
77 return ctx.map((ctx) => bindAdapter(ctx, errorRegistry))
78 },
79 }
80
81 copySymbolsFromSource(adapterFactory, boundFactory)
82
83 return boundFactory
84}
85
86// *.bind(adapter) is required to preserve the `this` context of functions whose
87// execution is delegated to napi.rs.

Callers

nothing calls this directly

Calls 3

wrapAsyncFunction · 0.85
bindAdapterFunction · 0.85
copySymbolsFromSourceFunction · 0.85

Tested by

no test coverage detected