Documentation
¶
Index ¶
- Constants
- func BuildDelioQueryNorm(phrase string, coords *delio.Coordinates) string
- func BuildFriscoQueryNorm(phrase, categoryID string) string
- func IngestCart(provider string, payload any) error
- func IngestGet(provider string, payload any) error
- func IngestSearch(provider, queryText string, payload any) error
- func IsFresh(rec *QueryRecord, now time.Time) bool
- func IsStale(rec *QueryRecord, now time.Time) bool
- type DB
- func (db *DB) Close() error
- func (db *DB) GetQuery(ctx context.Context, provider, queryNorm string) (*QueryRecord, error)
- func (db *DB) Path() string
- func (db *DB) UpsertProducts(ctx context.Context, records []ProductRecord) error
- func (db *DB) UpsertQueryError(ctx context.Context, provider, queryText, queryNorm, errorCode string, ...) error
- func (db *DB) UpsertQuerySuccess(ctx context.Context, input QuerySuccessInput) error
- type ProductRecord
- func NormalizeDelioCart(payload any, seenAt time.Time) ([]ProductRecord, error)
- func NormalizeDelioGet(payload any, seenAt time.Time) ([]ProductRecord, error)
- func NormalizeDelioSearch(payload any, seenAt time.Time) ([]ProductRecord, error)
- func NormalizeFriscoCart(payload any, seenAt time.Time) ([]ProductRecord, error)
- func NormalizeFriscoGet(payload any, seenAt time.Time) ([]ProductRecord, error)
- func NormalizeFriscoSearch(payload any, seenAt time.Time) ([]ProductRecord, error)
- type QueryRecord
- type QuerySuccessInput
- type SnapshotRecord
Constants ¶
View Source
const ( SourceSearch = "search" SourceGet = "get" SourceCart = "cart" SourceOrder = "order" DefaultQueryTTLDays = 7 )
Variables ¶
This section is empty.
Functions ¶
func BuildDelioQueryNorm ¶
func BuildDelioQueryNorm(phrase string, coords *delio.Coordinates) string
func BuildFriscoQueryNorm ¶
func IngestCart ¶
func IngestSearch ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) UpsertProducts ¶
func (db *DB) UpsertProducts(ctx context.Context, records []ProductRecord) error
func (*DB) UpsertQueryError ¶
func (*DB) UpsertQuerySuccess ¶
func (db *DB) UpsertQuerySuccess(ctx context.Context, input QuerySuccessInput) error
type ProductRecord ¶
type ProductRecord struct {
Provider string
ExternalID string
Slug string
Name string
Brand string
Description string
MeasureValue float64
MeasureUnit string
MeasureText string
ImageURL string
Currency string
PriceMinor *int64
RegularPriceMinor *int64
PromoPriceMinor *int64
UnitPriceMinor *int64
Available *bool
Source string
SeenAt time.Time
SearchBlob string
RawJSON []byte
}
func NormalizeDelioCart ¶
func NormalizeDelioCart(payload any, seenAt time.Time) ([]ProductRecord, error)
func NormalizeDelioGet ¶
func NormalizeDelioGet(payload any, seenAt time.Time) ([]ProductRecord, error)
func NormalizeDelioSearch ¶
func NormalizeDelioSearch(payload any, seenAt time.Time) ([]ProductRecord, error)
func NormalizeFriscoCart ¶
func NormalizeFriscoCart(payload any, seenAt time.Time) ([]ProductRecord, error)
func NormalizeFriscoGet ¶
func NormalizeFriscoGet(payload any, seenAt time.Time) ([]ProductRecord, error)
func NormalizeFriscoSearch ¶
func NormalizeFriscoSearch(payload any, seenAt time.Time) ([]ProductRecord, error)
type QueryRecord ¶
type QuerySuccessInput ¶
Click to show internal directories.
Click to hide internal directories.