Documentation
¶
Overview ¶
Package cart contains user cart oriented logic.
Package cart is a generated GoMock package.
Package cart is a generated GoMock package.
Index ¶
- type Cart
- type Carts
- type Filter
- type ID
- type IDFilter
- type IDs
- type MockRepository
- func (m *MockRepository) Delete(ctx context.Context, filter *Filter) error
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) Get(ctx context.Context, filter *Filter) (*Cart, error)
- func (m *MockRepository) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
- func (m *MockRepository) Save(ctx context.Context, props *Props) (*Cart, error)
- type MockRepositoryMockRecorder
- type MockService
- func (m *MockService) Delete(ctx context.Context, filter *Filter) error
- func (m *MockService) EXPECT() *MockServiceMockRecorder
- func (m *MockService) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
- func (m *MockService) Save(ctx context.Context, props *Props) (*Cart, error)
- type MockServiceMockRecorder
- type Props
- type QueryCriteria
- type QueryResult
- type Repository
- type Service
- type UseCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cart ¶
type Cart struct { ID ID UserID user.ID CreatedAt time.Time UpdatedAt time.Time Props *Props Product *product.Product }
Cart represents the cart.
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) 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 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, filter *Filter) 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) Delete ¶
func (mr *MockServiceMockRecorder) Delete(ctx, filter any) *gomock.Call
Delete indicates an expected call of Delete.
type QueryCriteria ¶
type QueryCriteria struct {
Filter Filter
}
QueryCriteria represents a criteria for cart query.
type QueryResult ¶
type QueryResult struct {
Items Carts
}
QueryResult represents a result for cart query.
type Repository ¶
type Repository interface { Get(ctx context.Context, filter *Filter) (*Cart, error) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error) Save(ctx context.Context, props *Props) (*Cart, error) Delete(ctx context.Context, filter *Filter) error }
Repository represents cart repository.
type Service ¶
type Service interface { Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error) Save(ctx context.Context, props *Props) (*Cart, error) Delete(ctx context.Context, filter *Filter) error }
Service represents cart use cases.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
UseCase represents cart service.
func NewUseCase ¶
func NewUseCase(cartRepo Repository, productRepo product.Repository) *UseCase
NewUseCase create instance of UseCase.
func (UseCase) Query ¶
func (s UseCase) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
Query carts.