Documentation
¶
Index ¶
- Variables
- func NewAuthBusiness(repo repository.Repository, tokenMaker token.TokenMaker) *authBusiness
- func NewBusiness(repo repository.Repository, tokenMaker token.TokenMaker) *business
- func NewCartBusiness(repo repository.Repository) *cartBusiness
- func NewProductBusiness(repo repository.Repository) *productBusiness
- func NewUserBusiness(repo repository.Repository) *userBusiness
- type AuthBusiness
- type Business
- type CartBusiness
- type ProductBusiness
- type UserBusiness
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrHavenNoActiveCart = errors.New("haven no active cart") ErrCannotGetCart = errors.New("cannot get cart") ErrCannotCheckout = errors.New("cannot checkout") ErrProductNotFound = errors.New("product not found") ErrNegativeQuantity = errors.New("quantity must be at least 1") ErrCannotAddCartItem = errors.New("cannot add cart item") ErrCannotRemoveCartItem = errors.New("cannot remove cart item") ErrNoItems = errors.New("cart has no items") )
View Source
var ( ErrCannotCreateProduct = errors.New("cannot create product") ErrCannotUpdateProduct = errors.New("cannot update product") ErrCannotDeleteProduct = errors.New("cannot delete product") ErrCannotGetProduct = errors.New("cannot get product") ErrProductDeleted = errors.New("product is deleted") ErrCannotGetProductList = errors.New("cannot get all products") )
View Source
var ( ErrUserExisted = errors.New("user existed") ErrCannotRegister = errors.New("cannot register") )
View Source
var (
ErrEmailOrPasswordInvalid = errors.New("email or password invalid")
)
Functions ¶
func NewAuthBusiness ¶
func NewAuthBusiness(repo repository.Repository, tokenMaker token.TokenMaker) *authBusiness
func NewBusiness ¶
func NewBusiness(repo repository.Repository, tokenMaker token.TokenMaker) *business
func NewCartBusiness ¶
func NewCartBusiness(repo repository.Repository) *cartBusiness
func NewProductBusiness ¶
func NewProductBusiness(repo repository.Repository) *productBusiness
func NewUserBusiness ¶
func NewUserBusiness(repo repository.Repository) *userBusiness
Types ¶
type AuthBusiness ¶
type AuthBusiness interface {
Login(ctx context.Context, data *model.LoginParams) (interface{}, error)
}
type Business ¶
type Business interface { Product() ProductBusiness Cart() CartBusiness User() UserBusiness Auth() AuthBusiness }
type CartBusiness ¶
type ProductBusiness ¶
type ProductBusiness interface { Create(ctx context.Context, data *model.CreateProductParams) (*model.Product, error) Update(ctx context.Context, id int64, data *model.UpdateProductParams) (*model.Product, error) DeleteByID(ctx context.Context, id int64) error GetByID(ctx context.Context, id int64) (*model.Product, error) GetAll(ctx context.Context) ([]model.Product, error) }
type UserBusiness ¶
Click to show internal directories.
Click to hide internal directories.