Documentation
¶
Overview ¶
Package product is a generated GoMock package.
Package product is a generated GoMock package.
Package product contains product oriented logic.
Package product is a generated GoMock package.
Package product is a generated GoMock package.
Package product is a generated GoMock package.
Index ¶
- type Filter
- type ID
- type IDFilter
- type IDs
- type Image
- type ImageFilter
- type ImageID
- type ImageIDFilter
- type ImageIDs
- type ImageProps
- type ImageQueryCriteria
- type ImageRepository
- type ImageService
- type ImageUseCase
- type Images
- type MockImageRepository
- func (m *MockImageRepository) BulkCreate(ctx context.Context, images Images) (Images, error)
- func (m *MockImageRepository) Delete(ctx context.Context, filter *ImageFilter) error
- func (m *MockImageRepository) EXPECT() *MockImageRepositoryMockRecorder
- func (m *MockImageRepository) Get(ctx context.Context, filter *ImageFilter) (*Image, error)
- func (m *MockImageRepository) Query(ctx context.Context, criteria *ImageQueryCriteria) (Images, error)
- type MockImageRepositoryMockRecorder
- func (mr *MockImageRepositoryMockRecorder) BulkCreate(ctx, images any) *gomock.Call
- func (mr *MockImageRepositoryMockRecorder) Delete(ctx, filter any) *gomock.Call
- func (mr *MockImageRepositoryMockRecorder) Get(ctx, filter any) *gomock.Call
- func (mr *MockImageRepositoryMockRecorder) Query(ctx, criteria any) *gomock.Call
- type MockImageService
- type MockImageServiceMockRecorder
- type MockRepository
- func (m *MockRepository) Create(ctx context.Context, props *Props) (*Product, error)
- func (m *MockRepository) Delete(ctx context.Context, filter *Filter) error
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) Get(ctx context.Context, filter *Filter) (*Product, error)
- func (m *MockRepository) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
- func (m *MockRepository) Update(ctx context.Context, productID ID, props *Props) (*Product, error)
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) Create(ctx, props any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Delete(ctx, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Get(ctx, filter any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Query(ctx, criteria any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Update(ctx, productID, props any) *gomock.Call
- type MockSearchEngine
- type MockSearchEngineMockRecorder
- type MockService
- func (m *MockService) Create(ctx context.Context, props *Props) (*Product, error)
- func (m *MockService) Delete(ctx context.Context, productID ID) error
- func (m *MockService) EXPECT() *MockServiceMockRecorder
- func (m *MockService) Get(ctx context.Context, filter *Filter) (*Product, error)
- func (m *MockService) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
- func (m *MockService) Update(ctx context.Context, productID ID, props *Props) (*Product, error)
- type MockServiceMockRecorder
- func (mr *MockServiceMockRecorder) Create(ctx, props any) *gomock.Call
- func (mr *MockServiceMockRecorder) Delete(ctx, productID any) *gomock.Call
- func (mr *MockServiceMockRecorder) Get(ctx, filter any) *gomock.Call
- func (mr *MockServiceMockRecorder) Query(ctx, criteria any) *gomock.Call
- func (mr *MockServiceMockRecorder) Update(ctx, productID, props any) *gomock.Call
- type Ordering
- type Product
- type Products
- type Props
- type QueryCriteria
- type QueryResult
- type Repository
- type SearchEngine
- type SearchQueryCriteria
- type SearchQueryResult
- type Service
- type UseCase
- func (s UseCase) Create(ctx context.Context, props *Props) (*Product, error)
- func (s UseCase) Delete(ctx context.Context, productID ID) error
- func (s UseCase) Get(ctx context.Context, filter *Filter) (*Product, error)
- func (s UseCase) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
- func (s UseCase) Update(ctx context.Context, productID ID, props *Props) (*Product, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImageFilter ¶
type ImageFilter struct { ImageID ImageIDFilter ProductID IDFilter }
ImageFilter represents product image filter.
type ImageIDFilter ¶
ImageIDFilter represents ImageID filter.
type ImageProps ¶
ImageProps represents product image editable fields.
type ImageQueryCriteria ¶
type ImageQueryCriteria struct {
Filter ImageFilter
}
ImageQueryCriteria represents a criteria for image product query.
type ImageRepository ¶
type ImageRepository interface { BulkCreate(ctx context.Context, images Images) (Images, error) Get(ctx context.Context, filter *ImageFilter) (*Image, error) Query(ctx context.Context, criteria *ImageQueryCriteria) (Images, error) Delete(ctx context.Context, filter *ImageFilter) error }
ImageRepository represents product image repository.
type ImageService ¶
type ImageService interface { BulkCreate(ctx context.Context, productID ID, props []*image.StorageProps) (Images, error) Delete(ctx context.Context, imageID ImageID) error }
ImageService represents product image use cases.
type ImageUseCase ¶
type ImageUseCase struct {
// contains filtered or unexported fields
}
ImageUseCase represents product image service.
func NewImageUseCase ¶
func NewImageUseCase( logger *zap.Logger, productRepo Repository, imageRepo ImageRepository, imageStorage image.Storage, txManager repositoryx.TxManager, ) *ImageUseCase
NewImageUseCase create instance of ImageUseCase.
func (ImageUseCase) BulkCreate ¶
func (s ImageUseCase) BulkCreate( ctx context.Context, productID ID, props []*image.StorageProps, ) (Images, error)
BulkCreate product images.
type MockImageRepository ¶
type MockImageRepository struct {
// contains filtered or unexported fields
}
MockImageRepository is a mock of ImageRepository interface.
func NewMockImageRepository ¶
func NewMockImageRepository(ctrl *gomock.Controller) *MockImageRepository
NewMockImageRepository creates a new mock instance.
func (*MockImageRepository) BulkCreate ¶
BulkCreate mocks base method.
func (*MockImageRepository) Delete ¶
func (m *MockImageRepository) Delete(ctx context.Context, filter *ImageFilter) error
Delete mocks base method.
func (*MockImageRepository) EXPECT ¶
func (m *MockImageRepository) EXPECT() *MockImageRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockImageRepository) Get ¶
func (m *MockImageRepository) Get(ctx context.Context, filter *ImageFilter) (*Image, error)
Get mocks base method.
func (*MockImageRepository) Query ¶
func (m *MockImageRepository) Query(ctx context.Context, criteria *ImageQueryCriteria) (Images, error)
Query mocks base method.
type MockImageRepositoryMockRecorder ¶
type MockImageRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockImageRepositoryMockRecorder is the mock recorder for MockImageRepository.
func (*MockImageRepositoryMockRecorder) BulkCreate ¶
func (mr *MockImageRepositoryMockRecorder) BulkCreate(ctx, images any) *gomock.Call
BulkCreate indicates an expected call of BulkCreate.
func (*MockImageRepositoryMockRecorder) Delete ¶
func (mr *MockImageRepositoryMockRecorder) Delete(ctx, filter any) *gomock.Call
Delete indicates an expected call of Delete.
type MockImageService ¶
type MockImageService struct {
// contains filtered or unexported fields
}
MockImageService is a mock of ImageService interface.
func NewMockImageService ¶
func NewMockImageService(ctrl *gomock.Controller) *MockImageService
NewMockImageService creates a new mock instance.
func (*MockImageService) BulkCreate ¶
func (m *MockImageService) BulkCreate(ctx context.Context, productID ID, props []*image.StorageProps) (Images, error)
BulkCreate mocks base method.
func (*MockImageService) Delete ¶
func (m *MockImageService) Delete(ctx context.Context, imageID ImageID) error
Delete mocks base method.
func (*MockImageService) EXPECT ¶
func (m *MockImageService) EXPECT() *MockImageServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockImageServiceMockRecorder ¶
type MockImageServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockImageServiceMockRecorder is the mock recorder for MockImageService.
func (*MockImageServiceMockRecorder) BulkCreate ¶
func (mr *MockImageServiceMockRecorder) BulkCreate(ctx, productID, props any) *gomock.Call
BulkCreate indicates an expected call of BulkCreate.
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock of Repository interface.
func NewMockRepository ¶
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
NewMockRepository creates a new mock instance.
func (*MockRepository) Delete ¶
func (m *MockRepository) Delete(ctx context.Context, filter *Filter) error
Delete mocks base method.
func (*MockRepository) EXPECT ¶
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepository) Query ¶
func (m *MockRepository) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
Query mocks base method.
type MockRepositoryMockRecorder ¶
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository.
func (*MockRepositoryMockRecorder) Create ¶
func (mr *MockRepositoryMockRecorder) Create(ctx, props any) *gomock.Call
Create indicates an expected call of Create.
func (*MockRepositoryMockRecorder) Delete ¶
func (mr *MockRepositoryMockRecorder) Delete(ctx, filter any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockRepositoryMockRecorder) Get ¶
func (mr *MockRepositoryMockRecorder) Get(ctx, filter any) *gomock.Call
Get indicates an expected call of Get.
type MockSearchEngine ¶
type MockSearchEngine struct {
// contains filtered or unexported fields
}
MockSearchEngine is a mock of SearchEngine interface.
func NewMockSearchEngine ¶
func NewMockSearchEngine(ctrl *gomock.Controller) *MockSearchEngine
NewMockSearchEngine creates a new mock instance.
func (*MockSearchEngine) EXPECT ¶
func (m *MockSearchEngine) EXPECT() *MockSearchEngineMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSearchEngine) Index ¶
func (m *MockSearchEngine) Index(ctx context.Context, products Products) error
Index mocks base method.
func (*MockSearchEngine) Search ¶
func (m *MockSearchEngine) Search(ctx context.Context, criteria *SearchQueryCriteria) (*SearchQueryResult, error)
Search mocks base method.
type MockSearchEngineMockRecorder ¶
type MockSearchEngineMockRecorder struct {
// contains filtered or unexported fields
}
MockSearchEngineMockRecorder is the mock recorder for MockSearchEngine.
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) Delete ¶
func (m *MockService) Delete(ctx context.Context, productID ID) error
Delete mocks base method.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) Query ¶
func (m *MockService) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
Query mocks base method.
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) Create ¶
func (mr *MockServiceMockRecorder) Create(ctx, props any) *gomock.Call
Create indicates an expected call of Create.
func (*MockServiceMockRecorder) Delete ¶
func (mr *MockServiceMockRecorder) Delete(ctx, productID any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockServiceMockRecorder) Get ¶
func (mr *MockServiceMockRecorder) Get(ctx, filter any) *gomock.Call
Get indicates an expected call of Get.
type Ordering ¶
type Ordering struct {
Price *repositoryx.Order
}
Ordering represents order criteria.
type Props ¶
type Props struct { CategoryID category.ID Name string Description string Amount int64 Price int64 }
Props is a user-defined product properties.
type QueryCriteria ¶
type QueryCriteria struct { Filter Filter Ordering Ordering Pagination paging.Pagination }
QueryCriteria represents criteria for products query.
type QueryResult ¶
QueryResult represents a result for products query.
type Repository ¶
type Repository interface { Create(ctx context.Context, props *Props) (*Product, error) Update(ctx context.Context, productID ID, props *Props) (*Product, error) Delete(ctx context.Context, filter *Filter) error Get(ctx context.Context, filter *Filter) (*Product, error) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error) }
Repository represents product repository.
type SearchEngine ¶
type SearchEngine interface { Search(ctx context.Context, criteria *SearchQueryCriteria) (*SearchQueryResult, error) Index(ctx context.Context, products Products) error }
SearchEngine represents product search engine.
type SearchQueryCriteria ¶
type SearchQueryCriteria struct { Search string Pagination paging.Pagination }
SearchQueryCriteria represents criteria for products search.
type SearchQueryResult ¶
type SearchQueryResult struct {
Count int
}
SearchQueryResult represents a result for products search.
type Service ¶
type Service interface { Get(ctx context.Context, filter *Filter) (*Product, error) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error) Create(ctx context.Context, props *Props) (*Product, error) Update(ctx context.Context, productID ID, props *Props) (*Product, error) Delete(ctx context.Context, productID ID) error }
Service represents product use cases.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
UseCase represents product service.
func NewUseCase ¶
func NewUseCase( productRepo Repository, productImageRepo ImageRepository, imageStorage image.Storage, txManager repositoryx.TxManager, ) *UseCase
NewUseCase create instance of UseCase.
func (UseCase) Query ¶
func (s UseCase) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
Query products.