serverlesstechnology / cqrs

A lightweight, opinionated CQRS and event sourcing framework.
Other
370 stars 40 forks source link

[experiment] remove upcast API #47

Closed danieleades closed 1 year ago

danieleades commented 1 year ago

this is an experiment to test the approach described in #46

removing the upcast API reduces the amount of code to maintain by around 500 lines. Would require some documentation updates to demonstrate to users how to implement upcasting using serde.

Benefits:

Todo:

danieleades commented 1 year ago

One potential downside- this removes the event 'type' and 'version' from the metadata.

The event type is implicit in the payload, as is the major version of the event (using the internally tagged pattern described in #46).

Is that good enough? Are there other uses for this information aside from supporting the update model?

codecov[bot] commented 1 year ago

Codecov Report

Merging #47 (841f41e) into main (0c85cb0) will decrease coverage by 1.46%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #47      +/-   ##
==========================================
- Coverage   83.77%   82.32%   -1.46%     
==========================================
  Files          18       17       -1     
  Lines        2102     1771     -331     
==========================================
- Hits         1761     1458     -303     
+ Misses        341      313      -28     
Impacted Files Coverage Δ
src/doc.rs 58.77% <ø> (+1.07%) :arrow_up:
src/event.rs 94.73% <ø> (ø)
src/persist/serialized_event.rs 97.91% <ø> (+9.82%) :arrow_up:
src/persist/event_store.rs 93.77% <100.00%> (+0.84%) :arrow_up:

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.