item

package
v0.0.0-...-bb946b6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 10 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 {
	Service Service
}

func NewController

func NewController(dbconn *gorm.DB) Controller

func (Controller) CreateItem

func (ctrl Controller) CreateItem(ctx *gin.Context)

func (Controller) DeleteItem

func (ctrl Controller) DeleteItem(ctx *gin.Context)

func (Controller) GetItems

func (ctrl Controller) GetItems(ctx *gin.Context)

func (Controller) ReplaceItem

func (ctrl Controller) ReplaceItem(ctx *gin.Context)

func (Controller) UpdateItemStatus

func (ctrl Controller) UpdateItemStatus(ctx *gin.Context)

type Repository

type Repository struct {
	Database *gorm.DB
}

func NewRepository

func NewRepository(dbconn *gorm.DB) Repository

func (Repository) Create

func (repo Repository) Create(data *model.Item) error

func (Repository) Delete

func (repo Repository) Delete(id uint) error

func (Repository) Find

func (repo Repository) Find(query model.RequestFindItem) ([]model.Item, error)

func (Repository) GetByID

func (repo Repository) GetByID(id uint) (model.Item, error)

func (Repository) Replace

func (repo Repository) Replace(data model.Item) error

type Service

type Service struct {
	Repository Repository
	Validate   Validate
}

func NewService

func NewService(dbconn *gorm.DB) Service

func (Service) Create

func (service Service) Create(req model.RequestCreateItem) (model.Item, error)

func (Service) Delete

func (service Service) Delete(id uint) error

func (Service) Find

func (service Service) Find(query model.RequestFindItem) ([]model.Item, error)

func (Service) Replace

func (service Service) Replace(id uint, req model.RequestCreateItem) (model.Item, error)

func (Service) UpdateStatus

func (service Service) UpdateStatus(id uint, status constant.ItemStatus) (model.Item, error)

type Validate

type Validate struct {
}

func NewValidate

func NewValidate() Validate

func (Validate) DeleteItem

func (validator Validate) DeleteItem(current constant.ItemStatus) error

func (Validate) ItemStatusFlow

func (validator Validate) ItemStatusFlow(current, next constant.ItemStatus) error

func (Validate) UpdateItem

func (validator Validate) UpdateItem(current constant.ItemStatus) error

Jump to

Keyboard shortcuts

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