user

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFirstName = fmt.Errorf("user.User: invalid first name, is empty")
	ErrInvalidLastName  = fmt.Errorf("user.User: invalid last name, is empty")
	ErrInvalidEmail     = fmt.Errorf("user.User: invalid email, is empty")
	ErrInvalidBirthDate = fmt.Errorf("user.User: invalid birth date, not specified")
)
View Source
var Type = aggregate.Type[uuid.UUID, *User]{
	Name:    "User",
	Factory: func() *User { return &User{} },
}

Functions

This section is empty.

Types

type CreateCommand

type CreateCommand struct {
	FirstName, LastName string
	BirthDate           time.Time
	Email               string
}

func (CreateCommand) Name

func (CreateCommand) Name() string

type CreateCommandHandler

type CreateCommandHandler struct {
	UUIDGenerator  func() uuid.UUID
	UserRepository aggregate.Saver[uuid.UUID, *User]
}

func (CreateCommandHandler) Handle

type EmailWasUpdated

type EmailWasUpdated struct {
	Email string
}

func (EmailWasUpdated) Name

func (EmailWasUpdated) Name() string

type User

type User struct {
	aggregate.BaseRoot
	// contains filtered or unexported fields
}

func Create

func Create(id uuid.UUID, firstName, lastName, email string, birthDate time.Time) (*User, error)

func (*User) AggregateID

func (user *User) AggregateID() uuid.UUID

func (*User) Apply

func (user *User) Apply(event event.Event) error

func (*User) UpdateEmail

func (user *User) UpdateEmail(email string) error

type WasCreated

type WasCreated struct {
	ID        uuid.UUID
	FirstName string
	LastName  string
	BirthDate time.Time
	Email     string
}

func (WasCreated) Name

func (WasCreated) Name() string

Jump to

Keyboard shortcuts

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