Documentation ¶
Index ¶
Constants ¶
const ADDRESS_TYPE = "http://ns.dasch.swiss/repository#Address"
Variables ¶
var ErrAddressHasBeenDeleted = errors.New("address has been marked as deleted")
var ErrAddressNotFound = errors.New("no address found with the provided uuid")
var ErrNoAddressDataReturned = errors.New("no address data returned")
var ErrNoPropertiesChanged = errors.New("no new value for any property provided")
var ErrServerNotResponding = errors.New("server is not responding")
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { ID valueobject.Identifier Type string Street valueobject.Street PostalCode valueobject.PostalCode Locality valueobject.Locality Country valueobject.Country Canton valueobject.Canton Additional valueobject.Additional CreatedAt valueobject.Timestamp CreatedBy valueobject.Identifier ChangedAt valueobject.Timestamp ChangedBy valueobject.Identifier DeletedAt valueobject.Timestamp DeletedBy valueobject.Identifier Changes []event.Event }
Address domain entity TODO canton and additional should be optional
func NewAddress ¶
func NewAddress(id valueobject.Identifier, street valueobject.Street, postalCode valueobject.PostalCode, locality valueobject.Locality, country valueobject.Country, canton valueobject.Canton, additional valueobject.Additional) *Address
NewAddress creates a new address entity
func NewAddressFromEvents ¶
NewAddressFromEvents helper method creates new address from series of events
func (*Address) DeleteAddress ¶
func (a *Address) DeleteAddress(id valueobject.Identifier) error
DeleteAddress deletes an address entity
func (*Address) On ¶
On handles user events on the Address entity. The On method first does a type switch on the event and selects the case for each event type. This is where state change happens. Once an event is emitted and saved we do not throw an error, we simply process the event and carry on. We can change here if we decide that an event is no longer relevant or if it means something different, but we can’t return an error and say an event is invalid. Then we check if this is a new event. If it isn’t we increment the version number of Address entity
func (*Address) UpdateAddress ¶
func (a *Address) UpdateAddress(id valueobject.Identifier, street valueobject.Street, postalCode valueobject.PostalCode, locality valueobject.Locality, country valueobject.Country, canton valueobject.Canton, additional valueobject.Additional) error
UpdateAddress updates an address entity