usecase

package
v0.0.0-...-354f3a1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrDuplicate

func IsErrDuplicate(err error) bool

func IsErrFatal

func IsErrFatal(err error) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

func IsErrUseCase

func IsErrUseCase(err error) bool

Types

type CreateUserUseCase

type CreateUserUseCase interface {
	Create(user entity.User) (entity.User, error)
}

* CreateUser *

func NewCreateUserUseCase

func NewCreateUserUseCase(usersWriter entity.UsersWriter) CreateUserUseCase

type DeleteUserUseCase

type DeleteUserUseCase interface {
	Delete(id entity.UserID) error
}

* DeleteUser *

func NewDeleteUserUseCase

func NewDeleteUserUseCase(usersWriter entity.UsersWriter) DeleteUserUseCase

type EntityDuplicateError

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

* EntityDuplicateError *

func NewErrDuplicateEntity

func NewErrDuplicateEntity(entityName string, params map[string]string) EntityDuplicateError

func ToErrDuplicateEntity

func ToErrDuplicateEntity(err UseCaseError) EntityDuplicateError

func (EntityDuplicateError) EntityName

func (e EntityDuplicateError) EntityName() string

func (EntityDuplicateError) Error

func (e EntityDuplicateError) Error() string

func (EntityDuplicateError) Params

func (e EntityDuplicateError) Params() map[string]string

func (EntityDuplicateError) Type

func (e EntityDuplicateError) Type() ErrorType

type EntityNotFoundError

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

* EntityNotFoundError *

func NewErrNotFoundEntity

func NewErrNotFoundEntity(entityName string, params map[string]string) EntityNotFoundError

func ToErrNotFoundEntity

func ToErrNotFoundEntity(err UseCaseError) EntityNotFoundError

func (EntityNotFoundError) EntityName

func (e EntityNotFoundError) EntityName() string

func (EntityNotFoundError) Error

func (e EntityNotFoundError) Error() string

func (EntityNotFoundError) Params

func (e EntityNotFoundError) Params() map[string]string

func (EntityNotFoundError) Type

func (e EntityNotFoundError) Type() ErrorType

type ErrorType

type ErrorType int

* Error type *

const (
	ErrorTypeNotFoundEntity  ErrorType = iota
	ErrorTypeDuplicateEntity ErrorType = iota
	ErrorTypeFatal           ErrorType = iota
)

type FatalError

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

* Fatal error *

func NewErrFatal

func NewErrFatal(message string) FatalError

func ToErrFatal

func ToErrFatal(err UseCaseError) FatalError

func (FatalError) Error

func (e FatalError) Error() string

func (FatalError) Type

func (e FatalError) Type() ErrorType

type GetUserUseCase

type GetUserUseCase interface {
	Get(id entity.UserID) (entity.User, error)
}

* GetUser *

func NewGetUserUseCase

func NewGetUserUseCase(usersReader entity.UsersReader) GetUserUseCase

type ListUsersUseCase

type ListUsersUseCase interface {
	List() ([]entity.User, error)
}

* ListUsers *

func NewListUsersUseCase

func NewListUsersUseCase(usersReader entity.UsersReader) ListUsersUseCase

type UseCaseError

type UseCaseError interface {
	Type() ErrorType
	Error() string
}

* Use case error *

func ToUseCaseError

func ToUseCaseError(err error) UseCaseError

Jump to

Keyboard shortcuts

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