Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProductItem ¶
type ProductItem struct { ID int64 `json:"id"` Name string `json:"name"` Price Decimal `json:"price"` Manufacturer string `json:"manufacturer"` }
ProductItem ..
type Repository ¶
type Repository interface { GetProducts(ctx context.Context, page int64, pageSize int64) ([]ProductItem, error) GetProductByID(ctx context.Context, id int64) (ProductItem, error) AddProduct(ctx context.Context, item *ProductItem) (ProductItem, error) UpdateProduct(ctx context.Context, item *ProductItem) (ProductItem, error) RemoveProduct(ctx context.Context, id int64) (int64, error) }
Repository ..
type Service ¶
type Service interface { GetProducts(ctx context.Context, page int64, pageSize int64) ([]ProductItem, error) GetProductByID(ctx context.Context, id int64) (ProductItem, error) AddProduct( ctx context.Context, name string, price Decimal, manufacturer string, ) (ProductItem, error) UpdateProduct( ctx context.Context, id int64, name string, price Decimal, manufacturer string, ) (ProductItem, ServiceError) RemoveProduct(ctx context.Context, id int64) (int64, ServiceError) }
Service ..
type ServiceError ¶
type ServiceError interface { Message() string StatusCode() ServiceStatusCode }
ServiceError ..
func CreateServiceError ¶
func CreateServiceError(message string, statusCode ServiceStatusCode) ServiceError
CreateServiceError ..
type ServiceStatusCode ¶
type ServiceStatusCode string
ServiceStatusCode ..
const ( // ItemNotFound .. ItemNotFound ServiceStatusCode = "ItemNotFound" // InvalidItem .. InvalidItem ServiceStatusCode = "InvalidItem" // UnknownException .. UnknownException ServiceStatusCode = "UnknownException" )
Click to show internal directories.
Click to hide internal directories.