SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Jeremie/notify sql

Open lcodes opened this issue 1 year ago • 0 comments

Description of Changes

  • Added a new parameter on execute_sql to bring ModuleSubscriptions into scope.
  • Augmented Code::Pass with an optional Update structure to thread inserts/deletes back into execute_sql where they can be broadcast as an event to subscribers.
  • Updated tests to reflect these changes.

API and ABI breaking changes

If this is an API or ABI breaking change, please apply the corresponding GitHub label.

Expected complexity level and risk

2? Still a few things I'm unsure of:

  • Changed the return from evaluating delete from a count to an Update structure holding the count, but (afaik) the count wasn't used.
  • The new Update structure is almost identical to the one from core it then converts into, would it be preferable to move that one instead?
  • Moved ast transform and collect_result outside the transaction scope in execute_sql. Assuming these changes are safe.

Testing

Still need to add tests to validate that changes broadcast correctly.

lcodes avatar May 03 '24 02:05 lcodes