address

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ADDRESS_TYPE = "http://ns.dasch.swiss/repository#Address"

Variables

View Source
var ErrAddressHasBeenDeleted = errors.New("address has been marked as deleted")
View Source
var ErrAddressNotFound = errors.New("no address found with the provided uuid")
View Source
var ErrNoAddressDataReturned = errors.New("no address data returned")
View Source
var ErrNoPropertiesChanged = errors.New("no new value for any property provided")
View Source
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

func NewAddressFromEvents(e []event.Event) *Address

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) Events

func (a Address) Events() []event.Event

Events returns the uncommitted events from the Address entity

func (*Address) On

func (a *Address) On(ev event.Event, new bool)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL