Documentation ¶
Index ¶
- type HttpCreateRequest
- type HttpResponse
- type MySQLRepository
- type NewMySQLRepositoryParam
- type NewServiceParam
- type NewUseCaseParam
- type RepositoryFindAllParam
- type RepositoryFindAllResult
- type RepositoryFindByUsernameParam
- type RepositoryFindByUsernameResult
- type RepositoryInsertParam
- type RepositoryInsertResult
- type RepositoryInterface
- type Service
- type ServiceCreateParam
- type ServiceCreateResult
- type ServiceGetAllParam
- type ServiceGetAllResult
- type ServiceGetByUsernameParam
- type ServiceGetByUsernameResult
- type ServiceInterface
- type UseCase
- type UseCaseCreateParam
- type UseCaseCreateResult
- type UseCaseGetAllParam
- type UseCaseGetAllResult
- type UseCaseInterface
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpCreateRequest ¶
type HttpCreateRequest struct {
Username string `json:"username" binding:"required"`
}
type HttpResponse ¶
type MySQLRepository ¶
type MySQLRepository struct {
// contains filtered or unexported fields
}
func (*MySQLRepository) FindAll ¶
func (m *MySQLRepository) FindAll(param RepositoryFindAllParam) RepositoryFindAllResult
FindAll finds all user data from MySQL database.
func (*MySQLRepository) FindByUsername ¶
func (m *MySQLRepository) FindByUsername(param RepositoryFindByUsernameParam) RepositoryFindByUsernameResult
FindByUsername finds user data by username from MySQL database.
func (*MySQLRepository) Insert ¶
func (m *MySQLRepository) Insert(param RepositoryInsertParam) RepositoryInsertResult
Insert inserts user data into MySQL database.
type NewMySQLRepositoryParam ¶
type NewServiceParam ¶
type NewServiceParam struct {
Repository RepositoryInterface
}
type NewUseCaseParam ¶
type NewUseCaseParam struct {
Service ServiceInterface
}
type RepositoryFindAllParam ¶
type RepositoryFindAllResult ¶
type RepositoryInsertParam ¶
type RepositoryInsertResult ¶
type RepositoryInsertResult struct {
Error error `json:"error"`
}
type RepositoryInterface ¶
type RepositoryInterface interface { FindAll(param RepositoryFindAllParam) RepositoryFindAllResult FindByUsername(param RepositoryFindByUsernameParam) RepositoryFindByUsernameResult Insert(param RepositoryInsertParam) RepositoryInsertResult }
RepositoryInterface is the repository interface contract of the domain. Repository is a place where you communicate with the real external data source or database.
func NewMySQLRepository ¶
func NewMySQLRepository(param NewMySQLRepositoryParam) RepositoryInterface
NewMySQLRepository generates new MySQLRepository.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Create ¶
func (s *Service) Create(param ServiceCreateParam) ServiceCreateResult
Create creates user data.
func (*Service) GetAll ¶
func (s *Service) GetAll(param ServiceGetAllParam) ServiceGetAllResult
GetAll gets all user data.
func (*Service) GetByUsername ¶
func (s *Service) GetByUsername(param ServiceGetByUsernameParam) ServiceGetByUsernameResult
GetByUsername gets user data by username.
type ServiceCreateParam ¶
type ServiceCreateResult ¶
type ServiceCreateResult struct {
Error error `json:"error"`
}
type ServiceGetAllParam ¶
type ServiceGetAllResult ¶
type ServiceInterface ¶
type ServiceInterface interface { GetAll(param ServiceGetAllParam) ServiceGetAllResult GetByUsername(param ServiceGetByUsernameParam) ServiceGetByUsernameResult Create(param ServiceCreateParam) ServiceCreateResult }
ServiceInterface is the service interface contract of the domain. Service is the smallest partial from what the domain can do based on the main business flow. Service is a place where you use & call repository functions of the domain.
func NewService ¶
func NewService(param NewServiceParam) ServiceInterface
NewService generates new Service.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
func (*UseCase) Create ¶
func (u *UseCase) Create(param UseCaseCreateParam) UseCaseCreateResult
Create creates user data.
func (*UseCase) GetAll ¶
func (u *UseCase) GetAll(param UseCaseGetAllParam) UseCaseGetAllResult
GetAll gets all user data.
type UseCaseCreateParam ¶
type UseCaseCreateResult ¶
type UseCaseCreateResult struct {
Error error `json:"error"`
}
type UseCaseGetAllParam ¶
type UseCaseGetAllResult ¶
type UseCaseInterface ¶
type UseCaseInterface interface { GetAll(param UseCaseGetAllParam) UseCaseGetAllResult Create(param UseCaseCreateParam) UseCaseCreateResult }
UseCaseInterface is the use case interface contract of the domain. UseCase describes what the domain can do based on the main business flow. UseCase is a place where you use & call service functions of the domain or services from other domains
func NewUseCase ¶
func NewUseCase(param NewUseCaseParam) UseCaseInterface
NewUseCase generates new UseCase.