models

package
v0.0.0-...-80236ea Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package models is a generated GoMock package.

Package models is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID          uuid.UUID  `json:"id"`
	Name        string     `json:"name"`
	Slug        string     `json:"slug"`
	Description *string    `json:"description"`
	Products    []*Product `json:"products,omitempty"`
	CreatedAt   int64      `json:"created_at"`
	UpdatedAt   *int64     `json:"updated_at"`
}

func NewCategory

func NewCategory(name, description string) (*Category, error)

func (*Category) MarshalBinary

func (c *Category) MarshalBinary() ([]byte, error)

func (*Category) UnmarshalBinary

func (c *Category) UnmarshalBinary(data []byte) error

func (*Category) Update

func (c *Category) Update(name, description string)

func (*Category) Validate

func (c *Category) Validate() error

type CategoryRepository

type CategoryRepository interface {
	CreateCategory(ctx context.Context, category *Category) (int64, error)
	UpdateCategory(ctx context.Context, id uuid.UUID, category *Category) (int64, error)
	DeleteCategory(ctx context.Context, id uuid.UUID) (int64, error)
	GetCategoryByID(ctx context.Context, id uuid.UUID) (*Category, error)
	GetManyCategory(ctx context.Context, data GetManyCategoryPayload) ([]*Category, error)
	DeleteAllCategoriesInCache(ctx context.Context) error
	DeleteCategoryInCache(ctx context.Context, categoryID uuid.UUID) error
	GetCategoryInCache(ctx context.Context, categoryID uuid.UUID) *Category
	SetCategoryInCache(ctx context.Context, category *Category, expiration time.Duration) error
	WithTx(tx sqlutils.SQLTX) CategoryRepository
	Client() sqlutils.SQLDB
}

TODO

type GetManyCategoryPayload

type GetManyCategoryPayload struct {
	Page           string
	PerPage        string
	OrderBy        string
	OrderDirection string
}

TODO

type GetManyProductPayload

type GetManyProductPayload struct {
	Page           string
	PerPage        string
	OrderBy        string
	OrderDirection string
}

TODO

type MockCategoryRepository

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

MockCategoryRepository is a mock of CategoryRepository interface.

func NewMockCategoryRepository

func NewMockCategoryRepository(ctrl *gomock.Controller) *MockCategoryRepository

NewMockCategoryRepository creates a new mock instance.

func (*MockCategoryRepository) Client

Client mocks base method.

func (*MockCategoryRepository) CreateCategory

func (m *MockCategoryRepository) CreateCategory(ctx context.Context, category *Category) (int64, error)

CreateCategory mocks base method.

func (*MockCategoryRepository) DeleteAllCategoriesInCache

func (m *MockCategoryRepository) DeleteAllCategoriesInCache(ctx context.Context) error

DeleteAllCategoriesInCache mocks base method.

func (*MockCategoryRepository) DeleteCategory

func (m *MockCategoryRepository) DeleteCategory(ctx context.Context, id uuid.UUID) (int64, error)

DeleteCategory mocks base method.

func (*MockCategoryRepository) DeleteCategoryInCache

func (m *MockCategoryRepository) DeleteCategoryInCache(ctx context.Context, categoryID uuid.UUID) error

DeleteCategoryInCache mocks base method.

func (*MockCategoryRepository) EXPECT

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

func (*MockCategoryRepository) GetCategoryByID

func (m *MockCategoryRepository) GetCategoryByID(ctx context.Context, id uuid.UUID) (*Category, error)

GetCategoryByID mocks base method.

func (*MockCategoryRepository) GetCategoryInCache

func (m *MockCategoryRepository) GetCategoryInCache(ctx context.Context, categoryID uuid.UUID) *Category

GetCategoryInCache mocks base method.

func (*MockCategoryRepository) GetManyCategory

func (m *MockCategoryRepository) GetManyCategory(ctx context.Context, data GetManyCategoryPayload) ([]*Category, error)

GetManyCategory mocks base method.

func (*MockCategoryRepository) SetCategoryInCache

func (m *MockCategoryRepository) SetCategoryInCache(ctx context.Context, category *Category, expiration time.Duration) error

SetCategoryInCache mocks base method.

func (*MockCategoryRepository) UpdateCategory

func (m *MockCategoryRepository) UpdateCategory(ctx context.Context, id uuid.UUID, category *Category) (int64, error)

UpdateCategory mocks base method.

func (*MockCategoryRepository) WithTx

WithTx mocks base method.

type MockCategoryRepositoryMockRecorder

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

MockCategoryRepositoryMockRecorder is the mock recorder for MockCategoryRepository.

func (*MockCategoryRepositoryMockRecorder) Client

Client indicates an expected call of Client.

func (*MockCategoryRepositoryMockRecorder) CreateCategory

func (mr *MockCategoryRepositoryMockRecorder) CreateCategory(ctx, category any) *gomock.Call

CreateCategory indicates an expected call of CreateCategory.

func (*MockCategoryRepositoryMockRecorder) DeleteAllCategoriesInCache

func (mr *MockCategoryRepositoryMockRecorder) DeleteAllCategoriesInCache(ctx any) *gomock.Call

DeleteAllCategoriesInCache indicates an expected call of DeleteAllCategoriesInCache.

func (*MockCategoryRepositoryMockRecorder) DeleteCategory

func (mr *MockCategoryRepositoryMockRecorder) DeleteCategory(ctx, id any) *gomock.Call

DeleteCategory indicates an expected call of DeleteCategory.

func (*MockCategoryRepositoryMockRecorder) DeleteCategoryInCache

func (mr *MockCategoryRepositoryMockRecorder) DeleteCategoryInCache(ctx, categoryID any) *gomock.Call

DeleteCategoryInCache indicates an expected call of DeleteCategoryInCache.

func (*MockCategoryRepositoryMockRecorder) GetCategoryByID

func (mr *MockCategoryRepositoryMockRecorder) GetCategoryByID(ctx, id any) *gomock.Call

GetCategoryByID indicates an expected call of GetCategoryByID.

func (*MockCategoryRepositoryMockRecorder) GetCategoryInCache

func (mr *MockCategoryRepositoryMockRecorder) GetCategoryInCache(ctx, categoryID any) *gomock.Call

GetCategoryInCache indicates an expected call of GetCategoryInCache.

func (*MockCategoryRepositoryMockRecorder) GetManyCategory

func (mr *MockCategoryRepositoryMockRecorder) GetManyCategory(ctx, data any) *gomock.Call

GetManyCategory indicates an expected call of GetManyCategory.

func (*MockCategoryRepositoryMockRecorder) SetCategoryInCache

func (mr *MockCategoryRepositoryMockRecorder) SetCategoryInCache(ctx, category, expiration any) *gomock.Call

SetCategoryInCache indicates an expected call of SetCategoryInCache.

func (*MockCategoryRepositoryMockRecorder) UpdateCategory

func (mr *MockCategoryRepositoryMockRecorder) UpdateCategory(ctx, id, category any) *gomock.Call

UpdateCategory indicates an expected call of UpdateCategory.

func (*MockCategoryRepositoryMockRecorder) WithTx

WithTx indicates an expected call of WithTx.

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

func (m *MockProductRepository) Client() sqlutils.SQLDB

Client mocks base method.

func (*MockProductRepository) CreateProduct

func (m *MockProductRepository) CreateProduct(ctx context.Context, data *Product) (int64, error)

CreateProduct mocks base method.

func (*MockProductRepository) DeleteProduct

func (m *MockProductRepository) DeleteProduct(ctx context.Context, id uuid.UUID) (int64, error)

DeleteProduct mocks base method.

func (*MockProductRepository) EXPECT

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

func (*MockProductRepository) GetManyProduct

func (m *MockProductRepository) GetManyProduct(ctx context.Context, data GetManyProductPayload) ([]*Product, error)

GetManyProduct mocks base method.

func (*MockProductRepository) GetManyProductByCategoryID

func (m *MockProductRepository) GetManyProductByCategoryID(ctx context.Context, categoryID uuid.UUID) ([]*Product, error)

GetManyProductByCategoryID mocks base method.

func (*MockProductRepository) GetProductByID

func (m *MockProductRepository) GetProductByID(ctx context.Context, id uuid.UUID) (*Product, error)

GetProductByID mocks base method.

func (*MockProductRepository) UpdateProduct

func (m *MockProductRepository) UpdateProduct(ctx context.Context, id uuid.UUID, data *Product) (int64, error)

UpdateProduct mocks base method.

func (*MockProductRepository) WithTx

WithTx mocks base method.

type MockProductRepositoryMockRecorder

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

MockProductRepositoryMockRecorder is the mock recorder for MockProductRepository.

func (*MockProductRepositoryMockRecorder) Client

Client indicates an expected call of Client.

func (*MockProductRepositoryMockRecorder) CreateProduct

func (mr *MockProductRepositoryMockRecorder) CreateProduct(ctx, data any) *gomock.Call

CreateProduct indicates an expected call of CreateProduct.

func (*MockProductRepositoryMockRecorder) DeleteProduct

func (mr *MockProductRepositoryMockRecorder) DeleteProduct(ctx, id any) *gomock.Call

DeleteProduct indicates an expected call of DeleteProduct.

func (*MockProductRepositoryMockRecorder) GetManyProduct

func (mr *MockProductRepositoryMockRecorder) GetManyProduct(ctx, data any) *gomock.Call

GetManyProduct indicates an expected call of GetManyProduct.

func (*MockProductRepositoryMockRecorder) GetManyProductByCategoryID

func (mr *MockProductRepositoryMockRecorder) GetManyProductByCategoryID(ctx, categoryID any) *gomock.Call

GetManyProductByCategoryID indicates an expected call of GetManyProductByCategoryID.

func (*MockProductRepositoryMockRecorder) GetProductByID

func (mr *MockProductRepositoryMockRecorder) GetProductByID(ctx, id any) *gomock.Call

GetProductByID indicates an expected call of GetProductByID.

func (*MockProductRepositoryMockRecorder) UpdateProduct

func (mr *MockProductRepositoryMockRecorder) UpdateProduct(ctx, id, data any) *gomock.Call

UpdateProduct indicates an expected call of UpdateProduct.

func (*MockProductRepositoryMockRecorder) WithTx

WithTx indicates an expected call of WithTx.

type Product

type Product struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Slug        string    `json:"slug"`
	Description *string   `json:"description"`
	Price       float64   `json:"price"`
	CategoryID  uuid.UUID `json:"category_id"`
	CreatedAt   int64     `json:"created_at"`
	UpdatedAt   *int64    `json:"updated_at"`
}

func NewProduct

func NewProduct(name, description string, price float64, categoryID uuid.UUID) (*Product, error)

func (*Product) MarshalBinary

func (c *Product) MarshalBinary() ([]byte, error)

func (*Product) UnmarshalBinary

func (c *Product) UnmarshalBinary(data []byte) error

func (*Product) Update

func (c *Product) Update(name, description string, price float64, categoryID uuid.UUID)

type ProductRepository

type ProductRepository interface {
	CreateProduct(ctx context.Context, data *Product) (int64, error)
	UpdateProduct(ctx context.Context, id uuid.UUID, data *Product) (int64, error)
	DeleteProduct(ctx context.Context, id uuid.UUID) (int64, error)
	GetProductByID(ctx context.Context, id uuid.UUID) (*Product, error)
	GetManyProduct(ctx context.Context, data GetManyProductPayload) ([]*Product, error)
	GetManyProductByCategoryID(ctx context.Context, categoryID uuid.UUID) ([]*Product, error)
	WithTx(tx sqlutils.SQLTX) ProductRepository
	Client() sqlutils.SQLDB
}

TODO

Jump to

Keyboard shortcuts

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