Created
May 4, 2020 14:37
-
-
Save AntonStoeckl/63b6c805b67760d2e2ee080d7cf1f82d to your computer and use it in GitHub Desktop.
Example for my iDDD with Go blog article series at https://medium.com/@TonyBologni
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package customer | |
import ( | |
"github.com/AntonStoeckl/go-iddd/service/shared/es" | |
) | |
type View struct { | |
ID string | |
EmailAddress string | |
IsEmailAddressConfirmed bool | |
GivenName string | |
FamilyName string | |
IsDeleted bool | |
Version uint | |
} | |
func BuildViewFrom(eventStream es.EventStream) View { | |
customer := buildCurrentStateFrom(eventStream) | |
customerView := View{ | |
ID: customer.id.String(), | |
EmailAddress: customer.emailAddress.String(), | |
IsEmailAddressConfirmed: customer.isEmailAddressConfirmed, | |
GivenName: customer.personName.GivenName(), | |
FamilyName: customer.personName.FamilyName(), | |
IsDeleted: customer.isDeleted, | |
Version: customer.currentStreamVersion, | |
} | |
return customerView | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment