longevity
longevity copied to clipboard
DSL to describe the "update" clause for an in place update
This is prerequisite for any further updateByKeyVal
or updateByQuery
work.
- I would recommend keeping it simple at first.
- Follow
longevity.model.query.QueryFilter
as a rough model. - Basic structure is
<prop> 'gets' <update-expr>
- Provide both an operator (
:=
maybe) and a pneumonic equivalent such asgets
)
- Provide both an operator (
- It's probably a good idea to restrict it to basic properties for the time being (i.e., things like ints and strings, not things like nested components, sets and lists)
- The update expression will vary by type; LHS and RHS have to match on type
- update expression should allow for literals, basic properties, and basic operators over the types such as addition, logical or, string concatenation, etc.
- Please do write some unit tests to make sure the DSL is fluent
- When in doubt, ask @sullivan- he will be happy to help
In the future, we might add support for things like:
- collections and nested components
- specialized operators such as
incr
that can either rely on underlying DB operators such as MongoDB's$inc
, or be expanded into equivalent expression e.g.x + 1