domain

package
v0.0.0-...-db6235c Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNKNOWN_USER_ERROR    = 1000
	INVALID_USER_ERROR    = 1001
	REPOSITORY_USER_ERROR = 1002
	NOT_FOUND_ERROR       = 1003
	INVALID_USER_ID_ERROR = 1004
	USER_DELETE_ERROR     = 1005
)

Users' errors goes from 1000 to 1999

Variables

This section is empty.

Functions

Types

type Email

type Email struct {
	Value string
}

Value Objects

func NewEmail

func NewEmail(value string) (Email, errors.App)

type FirstName

type FirstName struct {
	Value string
}

Value Objects

func NewFirstName

func NewFirstName(value string) (FirstName, errors.App)

type LastName

type LastName struct {
	Value string
}

Value Objects

func NewLastName

func NewLastName(value string) (LastName, errors.App)

type List

type List []User

type User

type User struct {
	Id        vo.Id
	FirstName FirstName
	LastName  LastName
	Email     Email
	CreatedAt vo.DateTime
}

func NewUser

func NewUser(id vo.Id, firstName FirstName, lastName LastName, email Email) User

func (*User) GetCreatedAt

func (u *User) GetCreatedAt() vo.DateTime

func (*User) GetEmail

func (u *User) GetEmail() Email

func (*User) GetFirstName

func (u *User) GetFirstName() FirstName

func (*User) GetId

func (u *User) GetId() vo.Id

func (*User) GetLastName

func (u *User) GetLastName() LastName

func (*User) UpdateProfile

func (u *User) UpdateProfile(fn FirstName, ln LastName, e Email) User

type UserRepository

type UserRepository interface {
	Save(ctx *context.Context, u User) *errors.AppError
	Find(ctx *context.Context, id vo.Id) (User, *errors.AppError)
	FindByCriteria(ctx *context.Context, c criteria.Criteria, o criteria.SorterCriteria, p criteria.PaginatorCriteria) (collection.Collection, *errors.AppError)
	Delete(ctx *context.Context, id vo.Id) *errors.AppError
}

Jump to

Keyboard shortcuts

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