-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invert the update columns syntax for update procedures (#494)
### What Slack thread for more context: https://hasurahq.slack.com/archives/C04NS5JCD8A/p1717760957475579 We want to introduce a different syntax for column update. Instead of bucketing by operations, we bucket by column names. #### Old API ```json { "_set": { "name": "Al", "address": "street"}, "_inc": { "age": 1}, "_concat": { "..." } } ``` #### New API ```json { "update_columns": { "name": { "_set": "Al" }, "address": { "_set": "street" }, "age": { "_inc": 1 } } } ``` This syntax is more consistent with other operations in other places, and makes it easy to augment the existing update procedure with new operations without adding arguments. ### How Warning: this code was written at night, extra care is advised. 1. We change the name of the `_set` argument in the schema to `update_columns` 2. We introduce a new object type for each column update with the structure `{ _set: value }` 3. The type for `update_columns` is all the columns in the table mapped to their object type. 4. We parse the `update_columns` object by parsing each column and its operation, and generate a `MutationValueExpression`. ## Versioning and changelog No need to worry about versioning. This is all in the `veryExperimentalWIP` mutationVersion.
- Loading branch information
Gil Mizrahi
committed
Jun 12, 2024
1 parent
188322e
commit 81cfa51
Showing
5 changed files
with
1,823 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.