Skip to content

Support watched queries#4

Open
simolus3 wants to merge 2 commits intomainfrom
watch-queries
Open

Support watched queries#4
simolus3 wants to merge 2 commits intomainfrom
watch-queries

Conversation

@simolus3
Copy link
Collaborator

@simolus3 simolus3 commented Feb 6, 2026

A core feature of all PowerSync SDKs is the ability to watch select statements for updates. This feature has been missing from the Rust SDK, mostly because I didn't know what the best way to expose it would be: Allocating a result buffer / array is natural in garbage-collected languages, but seems wasteful for Rust.

Instead, this adds watch_statement as a helper method taking:

  1. The SQL text and rusqlite::Params to run.
  2. A stateless function receiving a prepared statement reference and a copy of the parameters. It is invoked whenever any of the source tables could have changed.

The stream then emits the output of the function. This design is quite flexible, e.g. it allows functions to not step through the entire statement if they are only interested in a single row.

@simolus3 simolus3 requested a review from rkistner February 6, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant