MCPcopy Create free account
hub / github.com/GoogleChrome/samples / dbSet

Function dbSet

google-drive-embeddings/src/db.js:52–67  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

50 * Supports structured objects, arrays, and typed arrays (Float32Array) directly.
51 */
52export async function dbSet(key, value) {
53 try {
54 const db = await openDB();
55 return new Promise((resolve, reject) => {
56 const tx = db.transaction(STORE_NAME, 'readwrite');
57 const store = tx.objectStore(STORE_NAME);
58 const request = store.put(value, key);
59
60 request.onsuccess = () => resolve();
61 request.onerror = () => reject(request.error);
62 });
63 } catch (err) {
64 console.error(`IndexedDB put error for key "${key}":`, err);
65 throw err;
66 }
67}
68
69/**
70 * Deletes a single key from the store

Callers 2

processAndRenderTracksFunction · 0.90
saveEmbeddingsToCacheFunction · 0.90

Calls 3

resolveFunction · 0.85
openDBFunction · 0.70
errorMethod · 0.45

Tested by

no test coverage detected