Documentation ¶
Index ¶
- Variables
- func RunCompanyRepositoryTestSuite(t *testing.T, repository TestableCompanyRepository)
- type CompanyCollectionResponse
- type CompanyRepository
- type CompanyResponse
- type CompanyService
- func (s *CompanyService) DeleteCompany(req DeleteCompanyRequest) error
- func (s *CompanyService) FetchAll() (response CompanyCollectionResponse)
- func (s *CompanyService) FetchCompanyByID(id uuid.UUID) (CompanyResponse, error)
- func (s *CompanyService) RegisterCompany(req RegisterCompanyRequest) (CompanyResponse, error)
- func (s *CompanyService) UpdateCompany(req UpdateCompanyRequest) (CompanyResponse, error)
- type DeleteCompanyRequest
- type RegisterCompanyRequest
- type TestableCompanyRepository
- type UpdateCompanyRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConflict = errors.New("confict")
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func RunCompanyRepositoryTestSuite ¶
func RunCompanyRepositoryTestSuite(t *testing.T, repository TestableCompanyRepository)
Types ¶
type CompanyCollectionResponse ¶
type CompanyCollectionResponse struct { Total int Companies []CompanyResponse }
type CompanyRepository ¶
type CompanyRepository interface { // FindAll retrieves a collection of Companies sorted alphabetically by name. FindAll() []*domain.Company // FindByID retreives the company by id. If the company does not exist return ErrNotFound. FindByID(id uuid.UUID) (*domain.Company, error) // Insert inserts a new Company record into the repository. If the Company cannot be // persisted an error is returned. Insert(company *domain.Company) error // Update the Company in the repository. If the company does not exist throw an ErrNotFound. Update(company *domain.Company) error // Delete removes a company from the repository. Delete(company *domain.Company) error }
type CompanyResponse ¶
type CompanyService ¶
type CompanyService struct {
// contains filtered or unexported fields
}
func NewCompanyService ¶
func NewCompanyService(repository CompanyRepository) *CompanyService
func (*CompanyService) DeleteCompany ¶
func (s *CompanyService) DeleteCompany(req DeleteCompanyRequest) error
func (*CompanyService) FetchAll ¶
func (s *CompanyService) FetchAll() (response CompanyCollectionResponse)
func (*CompanyService) FetchCompanyByID ¶
func (s *CompanyService) FetchCompanyByID(id uuid.UUID) (CompanyResponse, error)
func (*CompanyService) RegisterCompany ¶
func (s *CompanyService) RegisterCompany(req RegisterCompanyRequest) (CompanyResponse, error)
func (*CompanyService) UpdateCompany ¶
func (s *CompanyService) UpdateCompany(req UpdateCompanyRequest) (CompanyResponse, error)
type DeleteCompanyRequest ¶
type RegisterCompanyRequest ¶
type RegisterCompanyRequest struct {
Name string
}
type TestableCompanyRepository ¶
type TestableCompanyRepository interface { CompanyRepository // Reset causes the Repository to revert to a clean empty state. Reset() }
type UpdateCompanyRequest ¶
Click to show internal directories.
Click to hide internal directories.