question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support an array of sliceId for setIndexDefinition?

See original GitHub issue

Is 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:closed
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
jamesgpearcecommented, Sep 25, 2022

Also check out https://beta.tinybase.org/demos/word-frequencies/ - I’m pretty pleased with how this worked out. Thank you for the inspiration!

1reaction
tienlecommented, Sep 27, 2022

So far, it works great. Thanks for the update @jamesgpearce 🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found