category

package
v0.0.0-...-f15602e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package category contains product category oriented logic.

Package category is a generated GoMock package.

Package category is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Categories

type Categories []*Category

Categories represents slice of Category.

type Category

type Category struct {
	ID        ID
	CreatedAt time.Time
	UpdatedAt time.Time
	Props     *Props
}

Category represents the category.

type Filter

type Filter struct {
	ID   IDFilter
	Name NameFilter
}

Filter represents category filter.

type ID

type ID int64

ID represents an id for category.

type IDFilter

type IDFilter struct {
	Eq  IDs
	Neq IDs
}

IDFilter represents ID filter.

type IDs

type IDs []ID

IDs represents a slice of ID.

func (IDs) ToInt64

func (ids IDs) ToInt64() []int64

ToInt64 convert slice of IDs to slice int64.

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) Create

func (m *MockRepository) Create(ctx context.Context, props *Props) (*Category, error)

Create mocks base method.

func (*MockRepository) Delete

func (m *MockRepository) Delete(ctx context.Context, id ID) error

Delete mocks base method.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) Get

func (m *MockRepository) Get(ctx context.Context, filter *Filter) (*Category, error)

Get mocks base method.

func (*MockRepository) Query

func (m *MockRepository) Query(ctx context.Context, criteria *QueryCriteria) (Categories, error)

Query mocks base method.

func (*MockRepository) Update

func (m *MockRepository) Update(ctx context.Context, id ID, props *Props) (*Category, error)

Update 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, id 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.

func (*MockRepositoryMockRecorder) Query

func (mr *MockRepositoryMockRecorder) Query(ctx, criteria any) *gomock.Call

Query indicates an expected call of Query.

func (*MockRepositoryMockRecorder) Update

func (mr *MockRepositoryMockRecorder) Update(ctx, id, props any) *gomock.Call

Update indicates an expected call of Update.

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, props *Props) (*Category, error)

Create mocks base method.

func (*MockService) Delete

func (m *MockService) Delete(ctx context.Context, id 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) (Categories, error)

Query mocks base method.

func (*MockService) Update

func (m *MockService) Update(ctx context.Context, id ID, props *Props) (*Category, error)

Update 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, id any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockServiceMockRecorder) Query

func (mr *MockServiceMockRecorder) Query(ctx, criteria any) *gomock.Call

Query indicates an expected call of Query.

func (*MockServiceMockRecorder) Update

func (mr *MockServiceMockRecorder) Update(ctx, id, props any) *gomock.Call

Update indicates an expected call of Update.

type NameFilter

type NameFilter struct {
	Eq  []string
	Neq []string
}

NameFilter represents name filter.

type Props

type Props struct {
	Name string
}

Props represents category editable fields.

type QueryCriteria

type QueryCriteria struct {
	Filter Filter
}

QueryCriteria represents a criteria for category query.

type Repository

type Repository interface {
	Create(ctx context.Context, props *Props) (*Category, error)
	Query(ctx context.Context, criteria *QueryCriteria) (Categories, error)
	Get(ctx context.Context, filter *Filter) (*Category, error)
	Update(ctx context.Context, id ID, props *Props) (*Category, error)
	Delete(ctx context.Context, id ID) error
}

Repository represents category repository.

type Service

type Service interface {
	Create(ctx context.Context, props *Props) (*Category, error)
	Query(ctx context.Context, criteria *QueryCriteria) (Categories, error)
	Update(ctx context.Context, id ID, props *Props) (*Category, error)
	Delete(ctx context.Context, id ID) error
}

Service represents category use cases.

type UseCase

type UseCase struct {
	// contains filtered or unexported fields
}

UseCase represents category service.

func NewUseCase

func NewUseCase(categoryRepo Repository) *UseCase

NewUseCase create instance of UseCase.

func (*UseCase) Create

func (s *UseCase) Create(ctx context.Context, props *Props) (*Category, error)

Create category.

func (*UseCase) Delete

func (s *UseCase) Delete(ctx context.Context, id ID) error

Delete category.

func (*UseCase) Query

func (s *UseCase) Query(ctx context.Context, criteria *QueryCriteria) (Categories, error)

Query categories.

func (*UseCase) Update

func (s *UseCase) Update(ctx context.Context, id ID, props *Props) (*Category, error)

Update category.

Directories

Path Synopsis
Package pg contains implementations for category repositories
Package pg contains implementations for category repositories

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL