products

package
v0.0.0-...-f8764fd Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	UseCase UseCase
}

func (Controller) SearchProducts

func (ctr Controller) SearchProducts(c *gin.Context)

type ProductRepositoryMock

type ProductRepositoryMock struct {
	Mock mock.Mock
}

func (*ProductRepositoryMock) FindByKeyword

func (repository *ProductRepositoryMock) FindByKeyword(keyword string) (products []*Products, err error)

type Products

type Products struct {
	ID        string    `json:"id" gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
	Name      string    `json:"name" gorm:"uniqueIndex"`
	Price     int64     `json:"price"`
	PromoID   string    `json:"promoId"`
	Stock     int64     `json:"stock"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type Promo

type Promo struct {
	ID        string    `json:"id" gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
	PromoCode string    `json:"promoCode" gorm:"uniqueIndex"`
	PromoType string    `json:"promoType"`
	Discount  int64     `json:"discount"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type Repository

type Repository interface {
	FindByKeyword(keyword string) ([]*Products, error)
}

func NewRepository

func NewRepository(db *gorm.DB) Repository

type UseCase

type UseCase interface {
	SearchProducts(keyword string) ([]*Products, error)
}

func NewUseCase

func NewUseCase(repo Repository) UseCase

Jump to

Keyboard shortcuts

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