Documentation ¶
Overview ¶
Package order contains user order oriented logic.
Package order is a generated GoMock package.
Package order is a generated GoMock package.
Package order is a generated GoMock package.
Index ¶
- func StatusStrings() []string
- type Filter
- type ID
- type IDFilter
- type IDs
- type MockProductRepository
- type MockProductRepositoryMockRecorder
- type MockRepository
- func (m *MockRepository) Create(ctx context.Context, order *Order) (*Order, error)
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) Get(ctx context.Context, filter *Filter) (*Order, error)
- func (m *MockRepository) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
- type MockRepositoryMockRecorder
- type MockService
- type MockServiceMockRecorder
- type Order
- type Orders
- type Product
- type ProductFilter
- type ProductID
- type ProductIDFilter
- type ProductIDs
- type ProductProps
- type ProductQueryCriteria
- type ProductRepository
- type Products
- type Props
- type QueryCriteria
- type QueryResult
- type Repository
- type Service
- type Status
- type UseCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatusStrings ¶
func StatusStrings() []string
StatusStrings returns a slice of all String values of the enum
Types ¶
type MockProductRepository ¶
type MockProductRepository struct {
// contains filtered or unexported fields
}
MockProductRepository is a mock of ProductRepository interface.
func NewMockProductRepository ¶
func NewMockProductRepository(ctrl *gomock.Controller) *MockProductRepository
NewMockProductRepository creates a new mock instance.
func (*MockProductRepository) BulkCreateTx ¶
func (m *MockProductRepository) BulkCreateTx(ctx context.Context, products Products) (Products, error)
BulkCreateTx mocks base method.
func (*MockProductRepository) EXPECT ¶
func (m *MockProductRepository) EXPECT() *MockProductRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockProductRepositoryMockRecorder ¶
type MockProductRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockProductRepositoryMockRecorder is the mock recorder for MockProductRepository.
func (*MockProductRepositoryMockRecorder) BulkCreateTx ¶
func (mr *MockProductRepositoryMockRecorder) BulkCreateTx(ctx, products any) *gomock.Call
BulkCreateTx indicates an expected call of BulkCreateTx.
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) 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, order any) *gomock.Call
Create indicates an expected call of Create.
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) Create ¶
func (m *MockService) Create(ctx context.Context) (*Order, error)
Create 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 any) *gomock.Call
Create indicates an expected call of Create.
type Product ¶
type Product struct { ID ProductID OrderID ID ProductID product.ID CreatedAt time.Time UpdatedAt time.Time Props *ProductProps }
Product represents the order product.
type ProductFilter ¶
type ProductFilter struct { ID ProductIDFilter OrderID IDFilter ProductID product.IDFilter }
ProductFilter represents order product filter.
type ProductIDFilter ¶
type ProductIDFilter struct { Eq ProductIDs Neq ProductIDs }
ProductIDFilter represents ProductID filter.
type ProductIDs ¶
type ProductIDs []ProductID
ProductIDs represents a slice of ProductID.
func (ProductIDs) ToInt64 ¶
func (ids ProductIDs) ToInt64() []int64
ToInt64 convert slice of IDs to slice int64.
type ProductProps ¶
ProductProps represents order product editable fields.
type ProductQueryCriteria ¶
type ProductQueryCriteria struct {
Filter ProductFilter
}
ProductQueryCriteria represents a criteria for order product query.
type ProductRepository ¶
type ProductRepository interface {
BulkCreateTx(ctx context.Context, products Products) (Products, error)
}
ProductRepository represents order product repository.
type QueryCriteria ¶
type QueryCriteria struct { Filter Filter Pagination paging.Pagination }
QueryCriteria represents criteria for service query.
type QueryResult ¶
QueryResult represents a result for order query.
type Repository ¶
type Repository interface { Create(ctx context.Context, order *Order) (*Order, error) Get(ctx context.Context, filter *Filter) (*Order, error) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error) }
Repository represents order repository.
type Service ¶
type Service interface { Get(ctx context.Context, filter *Filter) (*Order, error) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error) Create(ctx context.Context) (*Order, error) }
Service represents order use cases.
type Status ¶
type Status uint8
Status represents order's status.
func StatusString ¶
StatusString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
type UseCase ¶
type UseCase struct {
// contains filtered or unexported fields
}
UseCase represents order service.
func NewUseCase ¶
func NewUseCase( repository Repository, cartRepository cart.Repository, productRepository product.Repository, orderProductRepository ProductRepository, txManager repositoryx.TxManager, ) *UseCase
NewUseCase create instance of UseCase.
func (UseCase) Query ¶
func (uc UseCase) Query(ctx context.Context, criteria *QueryCriteria) (*QueryResult, error)
Query orders.