v3.5.0
- Breaking change to
ifNotExists
API. Previously, a set operation could take an ifNotExists call with a single parameter:
table.set(key, { someValue: ifNotExists('1') })
This API, while simple, was a tad limiting. In this case, it checked for the existence of the "someValue" property on the object being updated. However, there are cases where you may wish to set someValue
based on the existence of another property. This change makes this possible.
table.set(key, { someValue: ifNotExists('someOtherValue', '1') })
This API will typecheck the first parameter to ensure it exists on our object. Dot notation can be used e.g.
table.set(key, { someValue: ifNotExists('parent.child.someOtherValue', '1') })
Dot notation params will also be type checked.
- An addition of mathematical expressions for Set functions.
table.set(key, { someNumberValue: plus('someNumberValue', 1) })
table.set(key, { someNumberValue: minus('someNumberValue', 1) })
Dot notation can also be used to identify the attribute to be updated. Also typechecked.
ifNotExists
calls can be nested within the mathematical expressions
table.set(key, { someNumberValue: plus(ifNotExists('someNumberValue',0), 1) })