Created
January 19, 2022 16:18
-
-
Save GaetanoPiazzolla/4f8ecd38a0eba0c4a21c076ccbbdd37e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const store = createStore().setTable('pets', { | |
fido: {species: 'dog'}, | |
felix: {species: 'cat'}, | |
cujo: {species: 'dog'}, | |
}); | |
const indexes = createIndexes(store); | |
indexes.setIndexDefinition( | |
'bySpecies', // indexId | |
'pets', // tableId to index | |
'species', // cellId to index | |
); | |
console.log(indexes.getSliceIds('bySpecies')); | |
// -> ['dog', 'cat'] | |
console.log(indexes.getSliceRowIds('bySpecies', 'dog')); | |
// -> ['fido', 'cujo'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment