product

package
v0.0.0-...-e4a3b16 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormRepository

type GormRepository struct {
	DB *gorm.DB
}

func NewGormDBRepository

func NewGormDBRepository(db *gorm.DB) *GormRepository

func (*GormRepository) AddProduct

func (repo *GormRepository) AddProduct(product product.Product) error

func (*GormRepository) FindProductById

func (repo *GormRepository) FindProductById(id int) (*product.Product, error)

func (*GormRepository) UpdateProduct

func (repo *GormRepository) UpdateProduct(product product.Product) error

type Product

type Product struct {
	ID         uint       `gorm:"id;primaryKey;autoIncrement"`
	CategoryID uint       `gorm:"category_id"`
	Name       string     `gorm:"name"`
	Price      int        `gorm:"price"`
	Stock      int        `gorm:"stock"`
	Image      string     `gorm:"image"`
	Detail     string     `gorm:"detail"`
	CreatedAt  time.Time  `gorm:"created_at"`
	UpdatedAt  time.Time  `gorm:"updated_at"`
	DeletedAt  *time.Time `gorm:"deleted_at"`
}

func (*Product) ToProduct

func (col *Product) ToProduct() product.Product

Jump to

Keyboard shortcuts

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