package db import ( "github.com/gshopify/service-wrapper/model" "gshopper.com/gshopify/products/cache" "time" ) const defaultCurrency = "USD" var ( productKey = func(clause string, args ...any) *cache.SqlKey { return cache.NewSQLKey( "product", time.Minute, clause, args...) } productSelection = func(ln model.LanguageCode) []string { return append([]string{ "id", "handle", "type", "scope", "tags", "vendor", "collections", "images", "options", "created_at", "updated_at", "published_at", "deleted_at", }, ln.SqlFieldSelection("title", ""), ln.SqlFieldSelection("description", ""), ) } productCollectionSelection = func(ln model.LanguageCode) []string { return append([]string{ "id", "handle", "scope", "sort_order", "image", "template_suffix", "created_at", "updated_at", "published_at", "deleted_at", }, ln.SqlFieldSelection("title", ""), ln.SqlFieldSelection("description", ""), ) } productCollectionKey = func(clause string, args ...any) *cache.SqlKey { return cache.NewSQLKey( "product_collection", 3*time.Minute, clause, args..., ) } productOptionSelection = func(ln model.LanguageCode) []string { return append([]string{"id", "position", "created_at", "updated_at", "published_at", "deleted_at"}, ln.SqlFieldSelection("name", ""), ln.SqlArraySelection("values"), ) } productOptionKey = func(clause string, args ...any) *cache.SqlKey { return cache.NewSQLKey( "product_option", time.Minute, clause, args...) } productVariantKey = func(clause string, args ...any) *cache.SqlKey { return cache.NewSQLKey( "product_variant", time.Minute, clause, args...) } )