Skip to content

Commit

Permalink
SubscribeToAllTables, which hides "SELECT * FROM *" (#211)
Browse files Browse the repository at this point in the history
## Description of Changes

Per out-of-band discussion, add
`SubscriptionBuilder.SubscribeToAllTables`, which abstracts over
`SubscriptionBuilder.Subscribe(["SELECT * FROM *"])`.

In the future, we will change the implementation of this method, so that
it uses "legacy subscriptions" while `SubscriptionBuilder.Subscribe`
moves to using "mutable subscriptions." At that time, no other interface
will be provided for using "legacy subscriptions."
`SubscribeToAllTables` may also at some point be rewritten in terms of
"mutable subscriptions" somehow.

## API

 - [ ] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*

## Requires SpacetimeDB PRs

N/a

## Testsuite
*If you would like to run the your SDK changes in this PR against a
specific SpacetimeDB branch, specify that here. This can be a branch
name or a link to a PR.*

SpacetimeDB branch name: master

## Testing
*Write instructions for a test that you performed for this PR*

- [x] @cloutiertyler will use this in the new tutorial and report back.

---------

Co-authored-by: Ingvar Stepanyan <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>
  • Loading branch information
5 people authored Jan 14, 2025
1 parent 98640b7 commit bb22fcc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public SubscriptionBuilder<EventContext> OnError(Callback callback)
}

public SubscriptionHandle<EventContext> Subscribe(params string[] querySqls) => new(conn, Applied, Error, querySqls);

public void SubscribeToAllTables()
{
Subscribe("SELECT * FROM *");
}
}

public interface ISubscriptionHandle
Expand Down

0 comments on commit bb22fcc

Please sign in to comment.