// Apply mutates aggregate (calls respective event handle) and
// appends event to internal slice so they can be retrieved with Events method
// In order for Apply to work the derived aggregate struct needs to implement
// an event handler method for all events it produces eg:
//
// If it produces event of type: SomethingImportantHappened
// Derived aggregate should have the following method implemented:
// func (a *Aggr) OnSomethingImportantHappened(e SomethingImportantHappened) error
Apply mutates aggregate (calls respective event handle) and
appends event to internal slice so they can be retrieved with Events method
In order for Apply to work the derived aggregate struct needs to implement
an event handler method for all events it produces eg.

If it produces event of type: SomethingImportantHappened
Derived aggregate should have the following method implemented:
func (a *Aggr) OnSomethingImportantHappened(e SomethingImportantHappened) error
// Apply mutates aggregate ( calls respective event handle ) and // appends event to internal slice so they can be retrieved with Events method // In order for Apply to work the derived aggregate struct needs to implement // an event handler method for all events it produces eg : // // If it produces event of type : SomethingImportantHappened // Derived aggregate should have the following method implemented : // func ( a * Aggr ) OnSomethingImportantHappened ( e SomethingImportantHappened ) error
func (a *AggregateRoot) Apply(evts ...interface{}) error {
	for _, evt := range evts {
		err := a.mutate(evt)
		if err != nil {
			return err
		}
		a.appendEvent(evt)
	}
	return nil
}
func ( a * AggregateRoot ) Apply ( evts ... interface { } ) error { for _ , evt := range evts { err := a . mutate ( evt ) if err != nil { return err } a . appendEvent ( evt ) } return nil }
Apply mutates aggregate (calls respective event handle) and
appends event to internal slice so they can be retrieved with Events method
In order for Apply to work the derived aggregate struct needs to implement
an event handler method for all events it produces eg.
Apply mutates aggregate ( calls respective event handle ) and appends event to internal slice so they can be retrieved with Events method In order for Apply to work the derived aggregate struct needs to implement an event handler method for all events it produces eg .