MCPcopy
hub / github.com/BuilderIO/agent-native / getDb

Function getDb

packages/core/src/db/create-get-db.ts:159–165  ·  view source on GitHub ↗

* Get the Drizzle DB instance. Kicks off lazy init on first call. * If the async init hasn't completed yet, returns a lazy Proxy that * records the Drizzle chain (select/from/where/etc.) and replays it * once the DB driver finishes loading. Since callers always `await` * the final result

()

Source from the content-addressed store, hash-verified

157 * the final result, the proxy is transparent.
158 */
159 function getDb(): LibSQLDatabase<T> {
160 if (_db) return _db;
161 startInit();
162 if (_db) return _db;
163
164 return createLazyProxy(_dbReady!, []) as LibSQLDatabase<T>;
165 }
166
167 return getDb;
168}

Callers 15

loaderFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90
decks.tsFile · 0.90
design-systems.tsFile · 0.90
createShareLinkFunction · 0.90
share.tsFile · 0.90
loaderFunction · 0.90

Calls 2

startInitFunction · 0.85
createLazyProxyFunction · 0.85

Tested by

no test coverage detected