dataworker

package
v0.0.0-...-9588241 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CategorName = make(map[string]string)
View Source
var CategoryIds = make(map[string][]int)
View Source
var GlobalId = 0
View Source
var Hashmap = make(map[string]int)
View Source
var ProductsList = InitProducts()

Functions

This section is empty.

Types

type Category

type Category struct {
	Id   string
	Name string
}

type Categorys

type Categorys struct {
	Category []Category
}

type Data

type Data struct {
	Config    config.Config
	Data      interface{}
	Error     string
	Categorys Categorys
}

func InitData

func InitData(conf config.Config, data interface{}) *Data

func (*Data) AddData

func (d *Data) AddData(data interface{})

func (*Data) GetDataAndChangeTitle

func (d *Data) GetDataAndChangeTitle(title string) Data

type Product

type Product struct {
	Images        []string `json:"images"`
	Name          string   `json:"name"`
	NameId        string   `json:"name_id"`
	Price         float64  `json:"price"`
	Description   string   `json:"description"`
	Category      string   `json:"category"`
	CategoryId    string   `json:"category_id"`
	Reviews       []Review `json:"reviews"`
	Views         int      `json:"views"`
	AverageRating float64  `json:"average_rating"`
	IsDeleted     bool     `json:"isdeleted"`
	ID            int      `json:"id"`
}

func (*Product) AddReview

func (product *Product) AddReview(author, vertues, disadvantages, reviewtext, stars string) (err error)

func (*Product) AddView

func (product *Product) AddView()

type Products

type Products struct {
	Product []Product `json:"products"`
}

func InitProducts

func InitProducts() *Products

func (*Products) AddProduct

func (products *Products) AddProduct(p Product)

func (*Products) DelProduct

func (products *Products) DelProduct(id int)

func (*Products) EditProduct

func (products *Products) EditProduct(id int, p Product)

func (*Products) GetMultipleItems

func (products *Products) GetMultipleItems(count int) Products

func (*Products) GetProductById

func (products *Products) GetProductById(id int) (x Product, err error)

func (*Products) GetProductsByCategory

func (products *Products) GetProductsByCategory(categoryid string) (Products, error)

type Review

type Review struct {
	Author        string  `json:"author"`
	Virtues       string  `json:"vertues"`
	Disadvantages string  `json:"disadvantages"`
	ReviewText    string  `json:"reviewtext"`
	Stars         float64 `json:"stars"`
}

Jump to

Keyboard shortcuts

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