product

package
v0.0.0-...-9f313e0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	ID   int
	Name string
}

type ProductRepository

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

func NewProductRepository

func NewProductRepository(db *sql.DB) *ProductRepository

func (*ProductRepository) GetProductById

func (r *ProductRepository) GetProductById(id int) (Product, error)

GetProductById returns the product with the given id. This Product Entity was not supposed to be returned. We should return a DTO instead. However, we will return it for now to keep example simple.

type RepositoryInterface

type RepositoryInterface interface {
	GetProductById(id int) (Product, error)
}

type UseCase

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

func NewProductUseCase

func NewProductUseCase(repository RepositoryInterface) *UseCase

func (*UseCase) Execute

func (u *UseCase) Execute(id int) (Product, error)

Jump to

Keyboard shortcuts

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