Why?
Previously DefaultMapper was using the following logic to register supported transport.Events in the constructor:
supported := map[stream.EventName]Event[T]{}
for _, e := range supportedEvents {
supported[e.ToStreamEvent().EventName()] = e
}
In case when the invocation of the method ToStreamEvent() on empty events was not possible - it could panic as an empty event is not an expected state usually for events - the entire repository construction was panicking.
What?
Now each transport.Event must provide a method returning the name of an event it corresponds to.
Tests
As the behavior should not change the existing tests already cover that. Only the _example events were adjusted to the modified interface.
Why? Previously
DefaultMapper
was using the following logic to register supportedtransport.Events
in the constructor:In case when the invocation of the method
ToStreamEvent()
on empty events was not possible - it could panic as an empty event is not an expected state usually for events - the entire repository construction was panicking.What? Now each
transport.Event
must provide a method returning the name of an event it corresponds to.Tests As the behavior should not change the existing tests already cover that. Only the
_example
events were adjusted to the modified interface.