product

package
v0.0.0-...-0d658de Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalBinary

func MarshalBinary(str []string) (data []byte)

func UnmarshalBinary

func UnmarshalBinary(bff []byte) []string

func UnmarshalProductsResume

func UnmarshalProductsResume(productResByte ...[]byte) (productResume *[]ProductResume, err error)

Types

type Product

type Product struct {
	Uid           string              `json:"uid,omitempty" redis:"uid,omitempty"`
	Name          string              `json:"name,omitempty" redis:"name,omitempty"`
	Description   string              `json:"description,omitempty" redis:"description,omitempty"`
	Pictures      []string            `json:"pictures,omitempty" redis:"pictures,omitempty"`
	CategoryCodes []string            `json:"-" redis:"category_codes,omitempty"`
	Categories    []category.Category `json:"categories,omitempty" redis:"-"`
	Freights      []freight.Freight   `json:"freights,omitempty" redis:"freights,omitempty"` //? Lista de fretes dísponivel para esse produto
	Freight       freight.Freight     `json:"freight,omitempty" redis:"-"`                   //? Frete selcionado para esse produto
	Price         int                 `json:"price,omitempty" redis:"price,omitempty"`
	Promotion     string              `json:"promotion,omitempty" redis:"promotion,omitempty"`
	Code          string              `json:"code,omitempty" redis:"code,omitempty"`
	Weight        string              `json:"weight,omitempty" redis:"weight,omitempty"`
	Color         string              `json:"color,omitempty" redis:"color,omitempty"`
	Status        Status              `json:"status,omitempty" redis:"status,omitempty"`
	CreatedAt     string              `json:"created_at,omitempty" redis:"created_at,omitempty"`
	UpdatedAt     string              `json:"updated_at,omitempty" redis:"updated_at,omitempty"`
}

func New

func New(productByte ...[]byte) (product *Product, err error)

func Repository

func Repository() *Product

func (*Product) AddCategory

func (p *Product) AddCategory(ctg category.Category) []category.Category

func (*Product) ApplyCategoryCodes

func (p *Product) ApplyCategoryCodes() []string

func (*Product) Delete

func (p *Product) Delete(product *Product) (err error)

func (*Product) FindCategory

func (p *Product) FindCategory(ctg category.Category) category.Category

func (*Product) ForEachCategory

func (p *Product) ForEachCategory(fn func(ctg category.Category)) []category.Category

func (*Product) ForEachCategoryCodes

func (p *Product) ForEachCategoryCodes(fn func(code string)) []string

func (*Product) GetByUid

func (p *Product) GetByUid(uid string) (product *Product, err error)

func (*Product) GetList

func (p *Product) GetList() (products []Product, err error)

func (*Product) GetUid

func (p *Product) GetUid(uid string) (product *Product, err error)

func (*Product) Inject

func (p *Product) Inject(product *Product) *Product

func (*Product) NewUid

func (p *Product) NewUid() string

func (*Product) RemoveCategory

func (p *Product) RemoveCategory(ctg category.Category) []category.Category

func (*Product) Restore

func (p *Product) Restore(product *Product) (err error)

func (*Product) Save

func (p *Product) Save(product *Product) (err error)

func (*Product) SetCategoryCodes

func (p *Product) SetCategoryCodes(codes []string) []string

func (*Product) SetCode

func (p *Product) SetCode(code string) string

func (*Product) SetColor

func (p *Product) SetColor(color string) string

func (*Product) SetCreatedAt

func (p *Product) SetCreatedAt(createdAt string) string

func (*Product) SetDescription

func (p *Product) SetDescription(description string) string

func (*Product) SetName

func (p *Product) SetName(name string) string

func (*Product) SetPictures

func (p *Product) SetPictures(pictures []string) []string

func (*Product) SetPrice

func (p *Product) SetPrice(price int) int

func (*Product) SetPromotion

func (p *Product) SetPromotion(promotion string) string

func (*Product) SetStatus

func (p *Product) SetStatus(status Status) Status

func (*Product) SetUid

func (p *Product) SetUid(uid string) string

func (*Product) SetUpdatedAt

func (p *Product) SetUpdatedAt(updatedAt string) string

func (*Product) SetWeight

func (p *Product) SetWeight(weight string) string

func (*Product) ToString

func (p *Product) ToString() (string, error)

func (*Product) Update

func (p *Product) Update(product *Product) (err error)

type ProductResume

type ProductResume struct {
	ProductUid      string          `json:"product_uid,omitempty" redis:"product_uid,omitempty"`
	FreightUid      string          `json:"freight_uid,omitempty" redis:"freight_uid,omitempty"`
	Product         Product         `json:"product,omitempty" redis:"product,omitempty"`
	Freight         freight.Freight `json:"freight,omitempty" redis:"freight,omitempty"`
	ZipcodeReceiver string          `json:"zipcode_receiver,omitempty" redis:"zipcode_receiver,omitempty"`
}

type ProductUid

type ProductUid struct {
	Uid    string `json:"document,omitempty" redis:"document,omitempty"`
	OldUid string `json:"old_document,omitempty" redis:"old_document,omitempty"`
}

func NewProductUid

func NewProductUid(productUidByte ...[]byte) (productUid *ProductUid, err error)

type Status

type Status string
const (
	Undefined Status = ""
	Enabled   Status = "enabled"
	Disabled  Status = "disabled"
)

Jump to

Keyboard shortcuts

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