Releases: Sandthorn/sandthorn
snapshot support
replace the property attribute_deltas array with hash in events
The new event structure
:aggregate_type => "SandthornProduct",
:aggregate_version => 1,
:aggregate_id => "da932773-dd06-43dc-8c0c-61837f009226",
:sequence_number => 1,
:event_name => "new",
:timestamp => "2014-04-08 12:22:09 UTC",
:event_data => {
:name => {
:old_value => "the old value",
:new_value => "the new value"
},
:price => {
:old_value => "the old value",
:new_value => "the new value"
}
}
where the change is in the :event_data. The old structure looked like this and are no longer valid
:event_data => {
:attribute_deltas => [
{
:attribute_name => "name",
:old_value => null,
:new_value => "Morgan"},
{
:attribute_name => "price",
:old_value => null,
:new_value => "Morgan"
}
]
}
The reason for the change is that its now easier to access the properties in the event_data
via a key. Before the attribute_deltas had to be iterated one by one to find the property of interest.
1.0.0
stateless_events and contructor_events
0.13.0 Bump to 0.13.0
use .all and .find interface from driver
Start using the .find and .all interface. This version of Sandthorn is dependent on version >= 3.1of sandthorn_driver_sequel.
Serialization moved to driver
The serialization mechanism are since Sandthorn version 0.11.0 moved to the drivers and the only driver that´s supported is version 3.0.0 of the SandthornDriverSequel. To use a previous version of Sandthorn you need to specify version 2.x of the SandthornDriverSequel.
::default_attributes
Its possible to add a default_attributes method on an aggregate and set default values to new and already created aggregates.
The default_attributes method will be run before initialize on Class.new and before the events when an aggregate is rebuilt. This will make is possible to add default attributes to an aggregate during its hole life cycle.
events method in AggregateRoot
Sandthorn::AggregateRoot::events
An abstraction over commit that creates events method that can be used to create private event methods.
Create event even if no attribute change in aggregate
Previously no event was created if no attribute changed in a aggregate, now an event is always created on a .commit
This make it possible to generate event that is not state related.
Bounded Context
The DDD concept Bounded Context are introduced.
It´s possible to map aggregate types to a driver on Sandthorn.configure.