aggregate

package
v0.0.0-...-7acbbf3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	// contains filtered or unexported fields
}

User aggregate with User as it's root entity

func NewUser

func NewUser() User

NewUser creates a new user with an auto generated uuid and limited role

func (*User) Email

func (u *User) Email() string

Email gets the user email

func (*User) GetDomainEventPayload

func (u *User) GetDomainEventPayload() UserDomainEvent

GetAggregateEventPayload returns a representation of the aggregate for event processing

func (*User) HasVerifiedEmail

func (u *User) HasVerifiedEmail() bool

HasVerifiedEmail gets the user has verified email flag

func (*User) IsActive

func (u *User) IsActive() bool

IsActive gets the user is active flag

func (*User) IsValid

func (u *User) IsValid() bool

IsValid checks if the user is valid

func (*User) LoadDomainEventObject

func (u *User) LoadDomainEventObject(p []byte) (UserDomainEvent, error)

LoadDomainEventObject unmarshal a byte array and returns UserDomainEvent if successful

func (*User) Location

func (u *User) Location() model.Location

Location gets the user location value object

func (*User) SetEmail

func (u *User) SetEmail(email string) error

SetUser sets the user

func (*User) SetHasVerifiedEmail

func (u *User) SetHasVerifiedEmail(b bool)

SetHasVerifiedEmail sets the user has verified email flag

func (*User) SetIsActive

func (u *User) SetIsActive(b bool)

SetIsActive sets the user is active flag

func (*User) SetLocation

func (u *User) SetLocation(nl model.Location)

SetLocation sets the user role

func (*User) SetToken

func (u *User) SetToken(tk model.Token)

SetToken sets the token object

func (*User) SetUser

func (u *User) SetUser(nu model.User)

SetUser sets the user

func (*User) Token

func (u *User) Token() model.Token

Token gets the user token value object

func (*User) User

func (u *User) User() model.User

User gets the user as aggregate root

func (*User) UserId

func (u *User) UserId() uuid.UUID

UserId gets the id of the user as aggregate root identity

type UserDomainEvent

type UserDomainEvent struct {
	ID               uuid.UUID `json:"ID"`
	FirstName        string    `json:"FirstName"`
	LastName         string    `json:"LastName"`
	Email            string    `json:"Email"`
	IsActive         bool      `json:"IsActive"`
	HasVerifiedEmail bool      `json:"HasVerifiedEmail"`
}

UserDomainEvent represents the domain event for the User aggregate

type UserEmailView

type UserEmailView struct {
	// contains filtered or unexported fields
}

UserEmailView is a snapshot of email information for user aggregate for read-only purposes

func NewUserEmailView

func NewUserEmailView(id uuid.UUID, email string, hasVerifiedEmail bool) UserEmailView

func (UserEmailView) Email

func (uev UserEmailView) Email() string

func (UserEmailView) Id

func (uev UserEmailView) Id() uuid.UUID

func (UserEmailView) IsEmailVerified

func (uev UserEmailView) IsEmailVerified() bool

type UserTokenView

type UserTokenView struct {
	// contains filtered or unexported fields
}

UserTokenView is a snapshot of tokens for user aggregate for read-only purposes

func NewUserTokenView

func NewUserTokenView(id uuid.UUID, vt, vs string) UserTokenView

func (UserTokenView) VerificationSalt

func (utv UserTokenView) VerificationSalt() string

func (UserTokenView) VerificationToken

func (utv UserTokenView) VerificationToken() string

Jump to

Keyboard shortcuts

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