application

package
v0.0.0-...-8950af9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DISABLE = "disable"
	ENABLE  = "enable"
)

Variables

View Source
var (
	ErrInvalidPrice  = errors.New("the price must be greater than zero to enable the product")
	ErrDisable       = errors.New("the price must be zero in order to have the product disable")
	ErrInvalidStatus = errors.New("status must be enable or disable")
)

Functions

This section is empty.

Types

type Product

type Product struct {
	ID     string  `valid:"uuidv4"`
	Name   string  `valid:"required"`
	Price  float64 `valid:"float,optional"`
	Status string  `valid:"required"`
}

func (*Product) Disable

func (p *Product) Disable() error

func (*Product) Enable

func (p *Product) Enable() error

func (*Product) GetID

func (p *Product) GetID() string

func (*Product) GetName

func (p *Product) GetName() string

func (*Product) GetPrice

func (p *Product) GetPrice() float64

func (*Product) GetStatus

func (p *Product) GetStatus() string

func (*Product) IsValid

func (p *Product) IsValid() (bool, error)

type ProductInterface

type ProductInterface interface {
	IsValid() (bool, error)
	Enable() error
	Disable() error
	GetID() string
	GetName() string
	GetStatus() string
	GetPrice() float64
}

Jump to

Keyboard shortcuts

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