You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
objectStore.createIndex("app_indices","appIndices",{multiEntry: true});functionfancyPut(idbDataStore,collectionName,collectionIndicesMap,appObj){constappIndices=collectionIndicies.map([indexName,indexEvalPath])=>{// for the example, assume the key is not nested...const appVal =appObj[indexEvalPath];if(Array.isArray(appVal)){thrownewError("The value can't be an array for our current bounds cleverness.");}// Create an index key that's array-structured so we can bound its// key-space.return[collectionName,indexName,appVal];});constwrappedObj={actualObj: appObjappIndices};returnidbDataStore.put(wrappedObj);}asyncfunctionfindWithIndex(idbDataStore,collectionName,indexName,appExact,[appLow,appHigh]){// [collectionName, indexName] lower-bounds all [collectionName, indexName, ...]// because a shorter array is by definition less than a longer array that is// equal up to their shared length.// [collectionName, indexName, []] upper-bounds all [collectionName, indexName, ...]// because arrays are always greater than strings/dates/numbers. So as long// as the other contents of the index are non-arrays, we're good.constwholeIndexBounds=IDBKeyRange.bound([collectionName,indexName],[collectionName,indexName,[]],true,true);// exclusive range for the edge-case values.constexactIndexBounds=IDBKeyRange.only([collectionName,indexName,appValue]);constrangeBounds=IDBKeyRange.bound([collectionName,indexName,appLow],[collectionName,indexName,appHigh],false,false);// assume caller meant inclusive.// DO ACTUAL INDEX STUFFreturnwrappedObj.actualObj;}
The text was updated successfully, but these errors were encountered:
alexcottner
added
the
stale
For marking issues as stale. Labeled issues will be closed soon if label is not removed.
label
Jul 23, 2024
As suggested by Andrew in https://bugzilla.mozilla.org/show_bug.cgi?id=1486980#c36
Example pseudocode:
The text was updated successfully, but these errors were encountered: