Support ADDing numbers #56
Draft
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.
An
ADDin an update expression lets you increment a number attribute which doesn't exist yet, treating it as zero. Trying to useSETto increment a non-existent attribute will throw:The current update operations allow
ADDing to a set attribute only (let ADD (path : Set<'T>) (values : seq<'T>)), this PR proposes adding support toADDto a number attribute.It's in draft right now because I'm looking for guidance on how you want this contribution to be implemented, should you want this contribution. The current changes shown in this PR are just the
silliestsimplest thing to verify the tests would pass.Specifically, I'm guessing we don't want various
ADD_*functions, so I'm thinking of how we could supportADDing numbers without introducing those. Perhaps:TODO
module UpdateOperatorstype UpdateOperatorswith static operators soADDcan be overloaded with the various number types, andmodule UpdateOperatorswhich exposes the the current functions so it's not a breaking changeUpdateExprRecord