add export as yml_catalog

This commit is contained in:
Aleksandr Trushkin
2024-01-26 19:34:47 +03:00
parent 6fe250896c
commit 90a7797a27
7 changed files with 371 additions and 57 deletions

View File

@ -0,0 +1,61 @@
package export
import "time"
type Param struct {
Name string `xml:"name,attr"`
Value string `xml:",chardata"`
}
type Offer struct {
ID int64 `xml:"id,attr"`
Type string `xml:"type,attr"`
Available bool `xml:"available,attr"`
URL string `xml:"url"`
Price int `xml:"price"`
CurrencyID string `xml:"currencyId"`
CategoryID int64 `xml:"categoryId"`
PictureURLs []string `xml:"picture"`
Vendor string `xml:"vendor"`
Model string `xml:"model"`
VendorCode int `xml:"vendorCode"`
TypePrefix string `xml:"typePrefix"`
Description string `xml:"description"`
ManufacturerWarrany bool `xml:"manufacturer_warranty"`
Params []Param `xml:"param"`
}
type Currency struct {
ID string `xml:"id,attr"` // RUR only
Rate int64 `xml:"rate,attr"` // 1?
}
type Category struct {
ID int64 `xml:"id,attr"`
ParentID int64 `xml:"parent_id,attr,omiempty"`
Name string `xml:",chardata"`
}
type Shop struct {
Name string `xml:"name"` // r
Company string `xml:"company"` // r
URL string `xml:"url"` // r
Platform string `xml:"platform"`
Version string `xml:"version"`
Currencies []Currency `xml:"currencies"` // r RUR only
Categories []Category `xml:"categories>category"` // r
Offers []Offer `xml:"offer"` // r
}
type YmlContainer struct {
XMLName struct{} `xml:"yml_catalog"`
YmlCatalog
}
type YmlCatalog struct {
Date time.Time `xml:"date,attr"`
Shop Shop `xml:"shop"`
}