application

package
v0.0.0-...-302d250 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DISABLED = "disabled"
	ENABLED  = "enabled"
)

Variables

This section is empty.

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 NewProduct

func NewProduct() *Product

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
}

type ProductPersistenceInterface

type ProductPersistenceInterface interface {
	ProductReader
	ProductWriter
}

type ProductReader

type ProductReader interface {
	Get(id string) (ProductInterface, error)
}

type ProductService

type ProductService struct {
	Persistence ProductPersistenceInterface
}

func NewProductService

func NewProductService(persistence ProductPersistenceInterface) *ProductService

func (*ProductService) Create

func (s *ProductService) Create(name string, price float64) (ProductInterface, error)

func (*ProductService) Disable

func (s *ProductService) Disable(product ProductInterface) (ProductInterface, error)

func (*ProductService) Enable

func (s *ProductService) Enable(product ProductInterface) (ProductInterface, error)

func (*ProductService) Get

type ProductServiceInterface

type ProductServiceInterface interface {
	Get(id string) (ProductInterface, error)
	Create(name string, price float64) (ProductInterface, error)
	Enable(product ProductInterface) (ProductInterface, error)
	Disable(product ProductInterface) (ProductInterface, error)
}

type ProductWriter

type ProductWriter interface {
	Save(product ProductInterface) (ProductInterface, error)
}

Directories

Path Synopsis
Package mock_application is a generated GoMock package.
Package mock_application is a generated GoMock package.

Jump to

Keyboard shortcuts

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