Documentation ¶
Overview ¶
Package usecase is a layer responsible for driving the workflow of the application, matching the use cases at hand. These operations are interface-independent and can be both synchronous or message-driven. This layer is well suited for spanning transactions, high-level logging and security. The application layer is thin in terms of domain logic it merely coordinates the domain layer objects to perform the actual work.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmailAlreadyInUse is when given email is already in use. ErrEmailAlreadyInUse = apperror.NewBadRequest("email address is already in use") )
Functions ¶
This section is empty.
Types ¶
type CreateUserDTO ¶
type CreateUserDTO struct { Email user.EmailAddress `json:"email,omitempty"` Password user.Password `json:"password,omitempty"` }
CreateUserDTO defines data required for creating an user.
func NewCreateUserDTO ¶
func NewCreateUserDTO(email user.EmailAddress, password user.Password) *CreateUserDTO
NewCreateUserDTO creates a CreateUserDTO.
func (CreateUserDTO) Validate ¶
func (c CreateUserDTO) Validate() (err *apperror.AppError)
Validate checks if the DTO has valid data
type CreateUserUseCase ¶
type CreateUserUseCase struct {
// contains filtered or unexported fields
}
CreateUserUseCase implements the logic for creatring an User.
func NewCreateUserUseCase ¶
func NewCreateUserUseCase(repo user.Repository) CreateUserUseCase
NewCreateUserUseCase creates a new Create User use case.
func (CreateUserUseCase) Execute ¶
func (u CreateUserUseCase) Execute(ctx context.Context, dto *CreateUserDTO) *apperror.AppError