app

package
v0.0.0-...-25be205 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 CompanyResponse struct {
	ID   uuid.UUID
	Name string
}

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 DeleteCompanyRequest struct {
	CompanyID uuid.UUID
}

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

type UpdateCompanyRequest struct {
	CompanyID uuid.UUID
	Name      string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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