data

package
v0.0.0-...-2082b0c Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotfoundError error = errors.New("product not found")

Functions

This section is empty.

Types

type Product

type Product struct {
	Id    int     `json:"id"`
	Title string  `json:"title" validate:"required,titleLength"`
	Price float64 `json:"price" validate:"gte=0,lte=2000000"`
}

func (*Product) FromJson

func (p *Product) FromJson(r io.Reader) error

func (*Product) ToJson

func (p *Product) ToJson(w io.Writer) error

func (*Product) Validate

func (p *Product) Validate() error

type ProductDB

type ProductDB struct {
	// contains filtered or unexported fields
}

func NewProductDB

func NewProductDB(c currency.CurrencyClient) *ProductDB

func (*ProductDB) AddProduct

func (pd *ProductDB) AddProduct(p *Product)

func (*ProductDB) GetProductById

func (pd *ProductDB) GetProductById(id int, destCurrency string) (*Product, error)

func (*ProductDB) GetProducts

func (pd *ProductDB) GetProducts(destCurrency string) (*Products, error)

func (*ProductDB) UpdateProduct

func (pd *ProductDB) UpdateProduct(id int, p *Product) error

type Products

type Products []*Product

func (*Products) ToJson

func (p *Products) ToJson(w io.Writer) error

Jump to

Keyboard shortcuts

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