Documentation ¶
Index ¶
- type DatabaseRepository
- type Service
- func (s *Service) AddProductImages(productID entities.ID, images map[string][]byte, ...) (*entities.Product, error)
- func (s *Service) CreateCategory(category *entities.Category) (*entities.Category, error)
- func (s *Service) CreateManufacturer(manufacturer *entities.Manufacturer) (*entities.Manufacturer, error)
- func (s *Service) CreateProduct(product *entities.Product) (*entities.Product, error)
- func (s *Service) CreateService(service *entities.Service) (*entities.Service, error)
- func (s *Service) CreateServiceCategory(serviceCategory *entities.ServiceCategory) (*entities.ServiceCategory, error)
- func (s *Service) DeleteCategory(id entities.ID) error
- func (s *Service) DeleteCategoryImage(categoryID entities.ID) error
- func (s *Service) DeleteManufacturer(id entities.ID) error
- func (s *Service) DeleteManufacturerImage(manufacturerID entities.ID) error
- func (s *Service) DeleteProduct(id entities.ID) error
- func (s *Service) DeleteProductImage(productID, imageID entities.ID) error
- func (s *Service) DeleteService(id entities.ID) error
- func (s *Service) DeleteServiceCategory(id entities.ID) error
- func (s *Service) GetCategory(id entities.ID, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Category, error)
- func (s *Service) GetManufacturer(id entities.ID, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Manufacturer, error)
- func (s *Service) GetProduct(id entities.ID, resolved bool, imageConfigs map[string]imageproxy.ImageConfig) (*entities.ResolvedProduct, error)
- func (s *Service) GetService(id entities.ID) (*entities.Service, error)
- func (s *Service) GetServiceCategory(id entities.ID, resolved bool) (*entities.ResolvedServiceCategory, error)
- func (s *Service) ListCategories(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Category, error)
- func (s *Service) ListManufacturers(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Manufacturer, error)
- func (s *Service) ListProducts(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Product, error)
- func (s *Service) ListServiceCategories(resolved bool) ([]*entities.ResolvedServiceCategory, error)
- func (s *Service) UpdateCategory(category *entities.Category) (*entities.Category, error)
- func (s *Service) UpdateManufacturer(manufacturer *entities.Manufacturer) (*entities.Manufacturer, error)
- func (s *Service) UpdateProduct(product *entities.Product) (*entities.Product, error)
- func (s *Service) UpdateProductImage(productID, imageID entities.ID, order int) ([]*entities.Image, error)
- func (s *Service) UpdateService(service *entities.Service) (*entities.Service, error)
- func (s *Service) UpdateServiceCategory(serviceCategory *entities.ServiceCategory) (*entities.ServiceCategory, error)
- func (s *Service) UpsertCategoryImage(categoryID entities.ID, imageName string, imageContent []byte, ...) (*entities.Category, error)
- func (s *Service) UpsertManufacturerImage(manufacturerID entities.ID, imageName string, imageContent []byte, ...) (*entities.Manufacturer, error)
- type StorageRepository
- type Usecase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseRepository ¶
type DatabaseRepository interface { GetCategory(id entities.ID) (*entities.Category, error) ListCategories() ([]*entities.Category, error) CreateCategory(e *entities.Category) (*entities.Category, error) UpdateCategory(e *entities.Category) (*entities.Category, error) DeleteCategory(id entities.ID) error GetManufacturer(id entities.ID) (*entities.Manufacturer, error) ListManufacturers() ([]*entities.Manufacturer, error) CreateManufacturer(e *entities.Manufacturer) (*entities.Manufacturer, error) UpdateManufacturer(e *entities.Manufacturer) (*entities.Manufacturer, error) DeleteManufacturer(id entities.ID) error GetProduct(id entities.ID) (*entities.Product, error) ListProducts() ([]*entities.Product, error) CreateProduct(e *entities.Product) (*entities.Product, error) UpdateProduct(e *entities.Product) (*entities.Product, error) UpdateProductImages(id entities.ID, images []*entities.Image) ([]*entities.Image, error) DeleteProduct(id entities.ID) error GetService(id entities.ID) (*entities.Service, error) ListServices(optionalServiceCategoryID entities.ID) ([]*entities.Service, error) CreateService(e *entities.Service) (*entities.Service, error) UpdateService(e *entities.Service) (*entities.Service, error) DeleteService(id entities.ID) error GetServiceCategory(id entities.ID) (*entities.ServiceCategory, error) ListServiceCategories() ([]*entities.ServiceCategory, error) CreateServiceCategory(e *entities.ServiceCategory) (*entities.ServiceCategory, error) UpdateServiceCategory(e *entities.ServiceCategory) (*entities.ServiceCategory, error) DeleteServiceCategory(id entities.ID) error GetImage(id entities.ID) (*entities.Image, error) UpdateImage(id entities.ID, ownerID entities.ID, newOrder int) ([]*entities.Image, error) DeleteImage(id entities.ID) error }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(db DatabaseRepository, imageProxy imageproxy.Service, imageStorage StorageRepository) *Service
func (*Service) AddProductImages ¶
func (s *Service) AddProductImages(productID entities.ID, images map[string][]byte, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Product, error)
AddProductImages adds multiple images to a product
func (*Service) CreateCategory ¶
CreateCategory creates a new category
func (*Service) CreateManufacturer ¶
func (s *Service) CreateManufacturer(manufacturer *entities.Manufacturer) (*entities.Manufacturer, error)
CreateManufacturer creates a new manufacturer
func (*Service) CreateProduct ¶
CreateProduct creates a new product
func (*Service) CreateService ¶ added in v1.1.0
CreateService creates a new service
func (*Service) CreateServiceCategory ¶ added in v1.1.0
func (s *Service) CreateServiceCategory(serviceCategory *entities.ServiceCategory) (*entities.ServiceCategory, error)
CreateServiceCategory creates a new service category
func (*Service) DeleteCategory ¶
DeleteCategory deletes a single category by ID
func (*Service) DeleteCategoryImage ¶
DeleteCategoryImage cleares the image of the category
func (*Service) DeleteManufacturer ¶
DeleteManufacturer deletes a single manufacturer by ID
func (*Service) DeleteManufacturerImage ¶
DeleteManufacturerImage cleares the image of the manufacturer
func (*Service) DeleteProduct ¶
DeleteProduct deletes a single product by ID
func (*Service) DeleteProductImage ¶
DeleteProductImage deletes a single image for a product
func (*Service) DeleteService ¶ added in v1.1.0
DeleteService deletes a single service by ID
func (*Service) DeleteServiceCategory ¶ added in v1.1.0
DeleteServiceCategory deletes a single serviceCategory by ID
func (*Service) GetCategory ¶
func (s *Service) GetCategory(id entities.ID, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Category, error)
GetCategory fetches a single category by ID
func (*Service) GetManufacturer ¶
func (s *Service) GetManufacturer(id entities.ID, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Manufacturer, error)
GetManufacturer fetches a single manufacturer by ID
func (*Service) GetProduct ¶
func (s *Service) GetProduct(id entities.ID, resolved bool, imageConfigs map[string]imageproxy.ImageConfig) (*entities.ResolvedProduct, error)
GetProduct fetches a single product by ID
func (*Service) GetService ¶ added in v1.1.0
GetService fetches a single service by ID
func (*Service) GetServiceCategory ¶ added in v1.1.0
func (s *Service) GetServiceCategory(id entities.ID, resolved bool) (*entities.ResolvedServiceCategory, error)
GetServiceCategory fetches a single service category by ID
func (*Service) ListCategories ¶
func (s *Service) ListCategories(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Category, error)
ListCategories fetches all categories
func (*Service) ListManufacturers ¶
func (s *Service) ListManufacturers(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Manufacturer, error)
ListManufacturers fetches all manufacturers
func (*Service) ListProducts ¶
func (s *Service) ListProducts(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Product, error)
ListProducts fetches all products
func (*Service) ListServiceCategories ¶ added in v1.1.0
func (s *Service) ListServiceCategories(resolved bool) ([]*entities.ResolvedServiceCategory, error)
ListServiceCategories fetches all service categories
func (*Service) UpdateCategory ¶
UpdateCategory persists the provided category
func (*Service) UpdateManufacturer ¶
func (s *Service) UpdateManufacturer(manufacturer *entities.Manufacturer) (*entities.Manufacturer, error)
UpdateManufacturer persists the provided manufacturer
func (*Service) UpdateProduct ¶
UpdateProduct persists the provided product
func (*Service) UpdateProductImage ¶
func (s *Service) UpdateProductImage(productID, imageID entities.ID, order int) ([]*entities.Image, error)
Update product image
func (*Service) UpdateService ¶ added in v1.1.0
UpdateService persists the provided service
func (*Service) UpdateServiceCategory ¶ added in v1.1.0
func (s *Service) UpdateServiceCategory(serviceCategory *entities.ServiceCategory) (*entities.ServiceCategory, error)
UpdateServiceCategory persists the provided service category
func (*Service) UpsertCategoryImage ¶
func (s *Service) UpsertCategoryImage(categoryID entities.ID, imageName string, imageContent []byte, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Category, error)
UpsertCategoryImage adds/updates the image of the category with the provided one.
func (*Service) UpsertManufacturerImage ¶
func (s *Service) UpsertManufacturerImage(manufacturerID entities.ID, imageName string, imageContent []byte, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Manufacturer, error)
UpsertManufacturerImage adds/updates the image of the manufacturer with the provided one.
type StorageRepository ¶
type Usecase ¶
type Usecase interface { GetCategory(id entities.ID, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Category, error) ListCategories(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Category, error) CreateCategory(e *entities.Category) (*entities.Category, error) UpdateCategory(e *entities.Category) (*entities.Category, error) DeleteCategory(id entities.ID) error UpsertCategoryImage(categoryID entities.ID, imageName string, imageContent []byte, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Category, error) DeleteCategoryImage(categoryID entities.ID) error GetManufacturer(id entities.ID, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Manufacturer, error) ListManufacturers(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Manufacturer, error) CreateManufacturer(e *entities.Manufacturer) (*entities.Manufacturer, error) UpdateManufacturer(e *entities.Manufacturer) (*entities.Manufacturer, error) DeleteManufacturer(id entities.ID) error UpsertManufacturerImage(manufacturerID entities.ID, imageName string, imageContent []byte, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Manufacturer, error) DeleteManufacturerImage(manufacturerID entities.ID) error GetProduct(id entities.ID, resolved bool, imageConfigs map[string]imageproxy.ImageConfig) (*entities.ResolvedProduct, error) ListProducts(imageConfigs map[string]imageproxy.ImageConfig) ([]*entities.Product, error) CreateProduct(e *entities.Product) (*entities.Product, error) UpdateProduct(e *entities.Product) (*entities.Product, error) DeleteProduct(id entities.ID) error AddProductImages(id entities.ID, images map[string][]byte, imageConfigs map[string]imageproxy.ImageConfig) (*entities.Product, error) UpdateProductImage(productID, imageID entities.ID, order int) ([]*entities.Image, error) DeleteProductImage(productID, imageID entities.ID) error GetService(id entities.ID) (*entities.Service, error) CreateService(e *entities.Service) (*entities.Service, error) UpdateService(e *entities.Service) (*entities.Service, error) DeleteService(id entities.ID) error GetServiceCategory(id entities.ID, resolved bool) (*entities.ResolvedServiceCategory, error) ListServiceCategories(resolved bool) ([]*entities.ResolvedServiceCategory, error) CreateServiceCategory(e *entities.ServiceCategory) (*entities.ServiceCategory, error) UpdateServiceCategory(e *entities.ServiceCategory) (*entities.ServiceCategory, error) DeleteServiceCategory(id entities.ID) error }