model

package
v0.0.0-...-c31d802 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const PhoneNumberPattern = "[0-9]+"

Variables

Functions

This section is empty.

Types

type Address

type Address struct {
	domain.Entity

	ID             AddressID
	OwnerID        OwnerID
	FullName       FullName
	ZipCode        ZipCode
	StateOrRegion  StateOrRegion
	Line1          Line1
	Line2          *Line2
	PhoneNumber    PhoneNumber
	CreatedAt      time.Time
	DeletedAt      *time.Time
	UpdatedAt      time.Time
	OccurredEvents []*AddressEvent
}

func NewAddress

func NewAddress(
	id AddressID,
	ownerID OwnerID,
	fullName FullName,
	zipCode ZipCode,
	stateOrRegion StateOrRegion,
	line1 Line1,
	line2 *Line2,
	phoneNumber PhoneNumber,
) *Address

func (*Address) Delete

func (a *Address) Delete()

func (*Address) Equals

func (a *Address) Equals(other *Address) bool

func (*Address) IsDeleted

func (a *Address) IsDeleted() bool

func (*Address) SameIdentityAs

func (a *Address) SameIdentityAs(other *Address) bool

func (*Address) String

func (a *Address) String() string

func (*Address) Update

func (a *Address) Update(
	fullName *FullName,
	zipCode *ZipCode,
	stateOrRegion *StateOrRegion,
	line1 *Line1,
	line2 *Line2,
	phoneNumber *PhoneNumber,
) error

type AddressEvent

type AddressEvent struct {
	domain.Event

	Type    AddressEventType
	Address *Address
	// contains filtered or unexported fields
}

func NewAddressCreated

func NewAddressCreated(address *Address) *AddressEvent

func NewAddressDeleted

func NewAddressDeleted(address *Address) *AddressEvent

func NewAddressUpdated

func NewAddressUpdated(address *Address) *AddressEvent

func (*AddressEvent) OccurredOn

func (ae *AddressEvent) OccurredOn() time.Time

func (*AddressEvent) SameEventAs

func (ae *AddressEvent) SameEventAs(other *AddressEvent) bool

type AddressEventType

type AddressEventType string
const (
	AddressCreated AddressEventType = "address.created"
	AddressUpdated AddressEventType = "address.updated"
	AddressDeleted AddressEventType = "address.deleted"
)

func (*AddressEventType) SameValueAs

func (t *AddressEventType) SameValueAs(other *AddressEventType) bool

type AddressID

type AddressID struct {
	*domain.SomeIdentity
}

func GenerateAddressID

func GenerateAddressID() *AddressID

func NewAddressID

func NewAddressID(id string) (*AddressID, error)

type City

type City struct {
	*domain.SomeValueObject[string]
}

func NewCity

func NewCity(value string) (*City, error)

type FullName

type FullName struct {
	*domain.SomeValueObject[string]
}

func NewFullName

func NewFullName(value string) (*FullName, error)

type Line1

type Line1 struct {
	*domain.SomeValueObject[string]
}

func NewLine1

func NewLine1(value string) (*Line1, error)

type Line2

type Line2 struct {
	*domain.SomeValueObject[string]
}

func NewLine2

func NewLine2(value string) (*Line2, error)

type Owner

type Owner struct {
	domain.ValueObject

	ID        OwnerID
	DeletedAt *time.Time
}

func NewOwner

func NewOwner(id OwnerID, deletedAt *time.Time) *Owner

func (*Owner) Equals

func (aa *Owner) Equals(other *Owner) bool

func (*Owner) IsAvailable

func (aa *Owner) IsAvailable() bool

func (*Owner) SameValueAs

func (aa *Owner) SameValueAs(other *Owner) bool

type OwnerID

type OwnerID struct {
	*domain.SomeIdentity
}

func GenerateOwnerID

func GenerateOwnerID() *OwnerID

func NewOwnerID

func NewOwnerID(id string) (*OwnerID, error)

func (*OwnerID) Equals

func (oi *OwnerID) Equals(other *OwnerID) bool

func (*OwnerID) SameValueAs

func (oi *OwnerID) SameValueAs(other *OwnerID) bool

type OwnerService

type OwnerService interface {
	Find(ownerID OwnerID) (*Owner, error)
}

type PhoneNumber

type PhoneNumber struct {
	*domain.SomeValueObject[string]
}

func NewPhoneNumber

func NewPhoneNumber(value string) (*PhoneNumber, error)

func (*PhoneNumber) Equals

func (pn *PhoneNumber) Equals(other *PhoneNumber) bool

func (*PhoneNumber) SameValueAs

func (pn *PhoneNumber) SameValueAs(other *PhoneNumber) bool

type StateOrRegion

type StateOrRegion struct {
	*domain.SomeValueObject[string]
}

func NewStateOrRegion

func NewStateOrRegion(value string) (*StateOrRegion, error)

func (*StateOrRegion) Equals

func (sor *StateOrRegion) Equals(other *StateOrRegion) bool

func (*StateOrRegion) SameValueAs

func (sor *StateOrRegion) SameValueAs(other *StateOrRegion) bool

type ZipCode

type ZipCode struct {
	*domain.SomeValueObject[string]
}

func NewZipCode

func NewZipCode(value string) (*ZipCode, error)

func (*ZipCode) Equals

func (zc *ZipCode) Equals(other *ZipCode) bool

func (*ZipCode) SameValueAs

func (zc *ZipCode) SameValueAs(other *ZipCode) bool

Jump to

Keyboard shortcuts

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