Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("entity not found")
)
Functions ¶
func ListenGRPC ¶
Types ¶
type Repository ¶
type Repository interface {
Close()
PutProduct(ctx context.Context, p *models.Product) error
GetProductById(ctx context.Context, id string) (*models.Product, error)
ListProducts(ctx context.Context, skip, take uint64) ([]*models.Product, error)
ListProductsWithIDs(ctx context.Context, ids []string) ([]*models.Product, error)
SearchProducts(ctx context.Context, query string, skip, take uint64) ([]*models.Product, error)
UpdateProduct(ctx context.Context, updatedProduct *models.Product) error
DeleteProduct(ctx context.Context, productId string) error
}
func NewElasticRepository ¶
func NewElasticRepository(url string) (Repository, error)
type Service ¶
type Service interface {
PostProduct(ctx context.Context, name, description string, price float64, accountId int) (*models.Product, error)
GetProduct(ctx context.Context, id string) (*models.Product, error)
GetProducts(ctx context.Context, skip, take uint64) ([]*models.Product, error)
GetProductsWithIDs(ctx context.Context, ids []string) ([]*models.Product, error)
SearchProducts(ctx context.Context, query string, skip, take uint64) ([]*models.Product, error)
UpdateProduct(ctx context.Context, id, name, description string, price float64, accountId int) (*models.Product, error)
DeleteProduct(ctx context.Context, productId string, accountId int) error
GetProducer() sarama.AsyncProducer
}
func NewProductService ¶
func NewProductService(repository Repository, producer sarama.AsyncProducer) Service
Click to show internal directories.
Click to hide internal directories.