data

package
v0.0.0-...-43a32cb Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetData

func GetData(db SaveUser, w database.Wholesalers, log *logrus.Logger) error

GetData will get data from the web of wholesalers, and save that information on the database

func ReadCSV

func ReadCSV(path string, log *logrus.Logger) []database.Product

func WriteXlsx

func WriteXlsx(path string, log *logrus.Logger, products []database.Product) string

Types

type InventoryLevel

type InventoryLevel struct {
	Stock string `json:"value"`
}

type MainEntity

type MainEntity struct {
	Id string `json:"@id"`
}

type Offers

type Offers struct {
	Price          string `json:"price"`
	Availability   string `json:"availability"`
	InventoryLevel InventoryLevel
}

type Product

type Product struct {
	MainEntity  MainEntity `json:"mainEntityOfPage"`
	Name        string     `json:"name"`
	Image       string     `json:"image"`
	Description string     `json:"description"`
	Offers      Offers
}

This struct will be use for match JSON data

type SaveUser

type SaveUser interface {
	Create(p database.Product) error
}

Jump to

Keyboard shortcuts

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