NFC: inline insert/delete update handling #86
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
Instead of a separate TableOp enum, and 4 fields to handle insert/delete metadata in DbOp, use a nullable struct that contains non-nullable object + bytes pair internally:
insert
is present (non-nullable) anddelete
is nullable, that naturally indicates insert operationinsert
is nullable anddelete
is not, that's a deleteThis simplifies and shortens update handling as well as reduces risk of state getting out of sync - e.g. TableOp saying that the operation is insert should exist but field containing inserted value being null. Now nullable struct itself communicates whether there is an insert or not, without a separate enum.
API
If the API is breaking, please state below what will break
Requires SpacetimeDB PRs
List any PRs here that are required for this SDK change to work