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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	domain.Entity

	ID                AccountID
	Name              AccountName
	NamePronunciation AccountNamePronunciation
	Email             AccountEmail
	Password          AccountPassword
	CreatedAt         time.Time
	DeletedAt         *time.Time
	UpdatedAt         time.Time
	OccurredEvents    []*AccountEvent
}

func NewAccount

func NewAccount(
	id AccountID,
	name AccountName,
	namePronunciation AccountNamePronunciation,
	email AccountEmail,
	password AccountPassword,
) *Account

func (*Account) Delete

func (a *Account) Delete()

func (*Account) Equals

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

func (*Account) IsDeleted

func (a *Account) IsDeleted() bool

func (*Account) SameIdentityAs

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

func (*Account) String

func (a *Account) String() string

func (*Account) Update

func (a *Account) Update(
	name *AccountName,
	namePronunciation *AccountNamePronunciation,
	email *AccountEmail,
	password *AccountPassword,
) error

type AccountAddress

type AccountAddress struct {
	domain.ValueObject

	ID        AccountAddressID
	DeletedAt *time.Time
}

func NewAccountAddress

func NewAccountAddress(id AccountAddressID, deletedAt *time.Time) *AccountAddress

func (*AccountAddress) Equals

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

func (*AccountAddress) IsAvailable

func (aa *AccountAddress) IsAvailable() bool

func (*AccountAddress) SameValueAs

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

type AccountAddressID

type AccountAddressID struct {
	*domain.SomeIdentity
}

func NewAccountAddressID

func NewAccountAddressID(id string) (*AccountAddressID, error)

func (*AccountAddressID) Equals

func (aai *AccountAddressID) Equals(other *AccountAddressID) bool

func (*AccountAddressID) SameValueAs

func (aai *AccountAddressID) SameValueAs(other *AccountAddressID) bool

type AccountEmail

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

func NewAccountEmail

func NewAccountEmail(value string) (*AccountEmail, error)

func (*AccountEmail) Equals

func (ae *AccountEmail) Equals(other *AccountEmail) bool

func (*AccountEmail) SameValueAs

func (ae *AccountEmail) SameValueAs(other *AccountEmail) bool

type AccountEvent

type AccountEvent struct {
	domain.Event

	Type    AccountEventType
	Account *Account
	// contains filtered or unexported fields
}

func NewAccountCreated

func NewAccountCreated(account *Account) *AccountEvent

func NewAccountDeleted

func NewAccountDeleted(account *Account) *AccountEvent

func NewAccountUpdated

func NewAccountUpdated(account *Account) *AccountEvent

func (*AccountEvent) OccurredOn

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

func (*AccountEvent) SameEventAs

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

type AccountEventType

type AccountEventType string
const (
	AccountCreated AccountEventType = "account.created"
	AccountUpdated AccountEventType = "account.updated"
	AccountDeleted AccountEventType = "account.deleted"
)

func (*AccountEventType) SameValueAs

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

type AccountID

type AccountID struct {
	*domain.SomeIdentity
}

func GenerateAccountID

func GenerateAccountID() *AccountID

func NewAccountID

func NewAccountID(id string) (*AccountID, error)

type AccountName

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

func NewAccountName

func NewAccountName(value string) (*AccountName, error)

func (*AccountName) Equals

func (an *AccountName) Equals(other *AccountName) bool

func (*AccountName) SameValueAs

func (an *AccountName) SameValueAs(other *AccountName) bool

type AccountNamePronunciation

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

func NewAccountNamePronunciation

func NewAccountNamePronunciation(value string) (*AccountNamePronunciation, error)

type AccountPassword

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

func NewAccountPassword

func NewAccountPassword(value string) *AccountPassword

func NewAccountPasswordWithHash

func NewAccountPasswordWithHash(value string, id AccountID) (*AccountPassword, error)

func (*AccountPassword) Equals

func (ap *AccountPassword) Equals(other *AccountPassword) bool

func (*AccountPassword) Format

func (ap *AccountPassword) Format() string

func (*AccountPassword) SameValueAs

func (ap *AccountPassword) SameValueAs(other *AccountPassword) bool

type AddressBook

type AddressBook struct {
	domain.ValueObject

	AllAccountAddresses []*AccountAddress
}

func NewAddressBook

func NewAddressBook(allAccountAddresses []*AccountAddress) *AddressBook

func (*AddressBook) AvailableAccountAddresses

func (ab *AddressBook) AvailableAccountAddresses() []*AccountAddress

func (*AddressBook) Equals

func (ab *AddressBook) Equals(other *AddressBook) bool

func (*AddressBook) SameValueAs

func (ab *AddressBook) SameValueAs(other *AddressBook) bool

type AddressBookService

type AddressBookService interface {
	Find(accountID AccountID) (*AddressBook, error)
	Remove(accountAddressID AccountAddressID) error
}

Jump to

Keyboard shortcuts

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