MCPcopy
hub / github.com/codedogQBY/ReadAny / getDB

Function getDB

packages/core/src/db/db-core.ts:127–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125}
126
127export async function getDB(): Promise<IDatabase> {
128 if (db) return db;
129
130 if (!dbLoadPromise) {
131 dbLoadPromise = (async () => {
132 const platform = getPlatformService();
133 const loadedDb = await platform.loadDatabase(await getDatabaseLocation(DB_FILENAME));
134 await configureDatabaseConnection(loadedDb);
135 db = loadedDb;
136 return loadedDb;
137 })().finally(() => {
138 dbLoadPromise = null;
139 });
140 }
141
142 return dbLoadPromise;
143}
144
145/** Get or lazily open the local database (readany_local.db) */
146export async function getLocalDB(): Promise<IDatabase> {

Callers 15

saveFeedbackRecordFunction · 0.90
getFeedbackHistoryFunction · 0.90
markFeedbackReplySeenFunction · 0.90
getUnreadFeedbackCountFunction · 0.90
refreshFeedbackStatusFunction · 0.90
getNotesFunction · 0.90
getAllNotesFunction · 0.90
insertNoteFunction · 0.90
updateNoteFunction · 0.90
deleteNoteFunction · 0.90
getThreadsFunction · 0.90

Calls 4

getPlatformServiceFunction · 0.90
getDatabaseLocationFunction · 0.85
loadDatabaseMethod · 0.65

Tested by

no test coverage detected