Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultParser ¶
type DefaultParser struct {
HTMLParser HTMLParser
MetaTagParser MetaTagParser
OpenGraphParser OpenGraphParser
SchemaOrgParser SchemaOrgParser
}
DefaultParser combines the above parsers in a single convenient parser.
func NewDefaultParser ¶
func NewDefaultParser(url string, body []byte) DefaultParser
NewDefaultParser creates a new parser than combines other parsers.
func (DefaultParser) Product ¶
func (parser DefaultParser) Product() (Product, error)
Product returns the result of combining other Producters.
type HTMLParser ¶
HTMLParser looks through the HTML for certain values. It's not very accurate but can make a last-ditch attempt.
func (HTMLParser) Product ¶
func (parser HTMLParser) Product() (Product, error)
Product parses the HTML for a product.
type MetaTagParser ¶
MetaTagParser is more accurate than HTMLParser but will not be able to gather all info.
func (MetaTagParser) Product ¶
func (parser MetaTagParser) Product() (Product, error)
Product parses meta tags for product information.
type OpenGraphParser ¶
OpenGraphParser is generally very accurate but pricing is not used widely.
func (OpenGraphParser) Product ¶
func (parser OpenGraphParser) Product() (Product, error)
Product parses opengraph meta tags for product information.
type Product ¶
type Product struct {
Name string `json:"name"`
Description string `json:"description"`
Price int64 `json:"price"`
URL string `json:"url"`
Image string `json:"image"`
OriginalImage string `json:"originalImage"`
PossibleImages []string `json:"possibleImages"`
}
Product contains information about the thing a User wants to buy.
type Purchase ¶
Purchase is something a User wants to buy. TODO: Link it more appropriately with Product.
type SchemaOrgParser ¶
SchemaOrgParser is VERY accurate because it's what is intended to be shown On search engines.
func (SchemaOrgParser) Product ¶
func (parser SchemaOrgParser) Product() (Product, error)
Product parses schema org JSON for data about a product.
type User ¶
type User struct {
Email string `json:"email"`
Saved int64 `json:"saved"`
Contributions int64 `json:"contributions"`
Frequency string `json:"frequency"`
LastPaycheck *time.Time `json:"lastPaycheck"`
Purchases []Purchase `json:"purchases"`
}
User is the top level struct for, you guessed it, user data. The data is stored in an object database, so purchases Are stored as a property on the user, rather than by association.