Support an array of sliceId for setIndexDefinition?
See original GitHub issueIs your feature request related to a problem? Please describe.
We were trying to create indexes for events object by date. So that if we look for a specific date then it will return the collection of events that cover that given date.
Event { start: Date, end: Date, ...}
indexes.setIndexDefinition(
'eventsByDate',
'events',
(getCell) => ['2022-09-19', '2022-09-20'] // eg. return array of ISO date from this code: eachDayOfInterval(getCell('from'), getCell('to')).map((date) => formatISO(date))
);
indexes.getSliceRowIds('eventsByDate', '2022-09-19') // return events that cover this date
indexes.getSliceRowIds('eventsByDate', '2022-09-20') // return events that cover this date
Describe the solution you’d like I think if the setIndexDefinition could support having sliceId array to index rows then it’s more flexible.
Describe alternatives you’ve considered We are not sure of the best way to solve this with Tinybase without manually indexing rows by listening to the row-adding event.
Additional context N/A
Issue Analytics
- State:
- Created a year ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Array.prototype.slice() - JavaScript - MDN Web Docs
The slice() method preserves empty slots. If the sliced portion is sparse, the returned array is sparse as well. The slice() method is...
Read more >ArraySlice | Apple Developer Documentation
The ArraySlice type makes it fast and efficient for you to perform operations on sections of a larger array. Instead of copying over...
Read more >Sliced Variables - MATLAB & Simulink - MathWorks
A sliced variable is one whose value can be broken up into segments, or slices, ... Each iteration of the loop works on...
Read more >Work with arrays | BigQuery - Google Cloud
In Google Standard SQL for BigQuery, an array is an ordered list consisting of zero or more values of the same data type....
Read more >ArraySlice - Adobe Support
Negative value indicates that the array is sliced, with sequence starting from array's end. length. Element count from offset. Example ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also check out https://beta.tinybase.org/demos/word-frequencies/ - I’m pretty pleased with how this worked out. Thank you for the inspiration!
So far, it works great. Thanks for the update @jamesgpearce 🚀