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
I am testing how nanoSQL behaves and I found something that it is not what I am expecting, so I wanted to ask if I am wrong or there is a bug. I have done a codepen:
And then I run some simple code that inserts elements in the database.
So I run into these 2 issues:
1- The observable is called every time the database is modified. I can live with it, but then I see no much difference between nSQL().on("change") and .observable.
2- The number of rows (8) is bigger than the limit set (5)
Thank you!
The text was updated successfully, but these errors were encountered:
The observable actually uses .on("change") internally, but there are way more options for debouncing and filtering the output, all the options available:
nSQL().observable(()=>nSQL("users").query('select').limit(5).offset(5).emit()).debounce(1000)// dont trigger more than every second.distinct()// only trigger if the previous record doesn't match the next record to trigger.filter(rows=>rows.length>10)// use a filter function to only emit changes based on provided fn..map(rows=>rows)// mutate the result.first()// only emit the first change.skip(10)// skip the first n elements.take(10)// only get the first n elements.subscribe(update);
Hello,
I am testing how nanoSQL behaves and I found something that it is not what I am expecting, so I wanted to ask if I am wrong or there is a bug. I have done a codepen:
https://codepen.io/anon/pen/bKEqbM?editors=0010#anon-login
My idea was to check whether an observable was invoked when an inserted element affect the result query (in this case the "second page"):
nSQL().observable( ( ) =>
nSQL("users").query('select').limit( 5 ).offset( 5 ).emit() )
.subscribe( update ) ;
And then I run some simple code that inserts elements in the database.
So I run into these 2 issues:
1- The observable is called every time the database is modified. I can live with it, but then I see no much difference between nSQL().on("change") and .observable.
2- The number of rows (8) is bigger than the limit set (5)
Thank you!
The text was updated successfully, but these errors were encountered: