Hacker News new | ask | show | jobs
by cjbprime 3100 days ago
How would you (as the DB author) know when a query has updated results?
1 comments

Something like this:

  subscribe ('SELECT * FROM tableA', callback)
On the initial subscription, 'callback' would be called once for each row in 'tableA', then again when a row is inserted or updated. It would be the same as Firebase in this respect.
No, you as the person writing this new database, not you as the user of the API.
Not OP but I would watch for mutations in the subscribed columns, then test the changed rows on the query's constraints and fire an event if it satisfies them.

I'm sure there is a more clever/efficient way of doing this though, and I can't wait to see how he/she implements it.