items

package
v0.0.0-...-902682f Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateItemRepo

func CreateItemRepo(conn *gorm.DB) items.Repository

func ToListDomain

func ToListDomain(data []Items) (result []items.Domain)

Types

type Items

type Items struct {
	Id          int `gorm:"primaryKey"`
	CategoryId  int
	Category    category.Category `gorm:"foreignKey:CategoryId;association_foreignkey:Id"`
	Name        string
	PointRedeem int
	Stock       int
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func FromDomain

func FromDomain(domain items.Domain) Items

func (*Items) ToDomain

func (item *Items) ToDomain() items.Domain

type ItemsRepo

type ItemsRepo struct {
	DB *gorm.DB
}

func (*ItemsRepo) Create

func (rep *ItemsRepo) Create(ctx context.Context, itemCreate *items.Domain) (items.Domain, error)

func (*ItemsRepo) Delete

func (repo *ItemsRepo) Delete(ctx context.Context, id int) error

func (*ItemsRepo) GetAll

func (repo *ItemsRepo) GetAll(ctx context.Context) ([]items.Domain, error)

func (*ItemsRepo) GetByCategoryId

func (repo *ItemsRepo) GetByCategoryId(ctx context.Context, id int) ([]items.Domain, error)

func (*ItemsRepo) GetByItemId

func (repo *ItemsRepo) GetByItemId(ctx context.Context, id int) (items.Domain, error)

func (*ItemsRepo) Update

func (repo *ItemsRepo) Update(ctx context.Context, itemUpdate items.Domain) (items.Domain, error)

func (*ItemsRepo) UpdateStock

func (repo *ItemsRepo) UpdateStock(ctx context.Context, itemUpdate items.Domain) (items.Domain, error)

Jump to

Keyboard shortcuts

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