12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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", "profile_id", "collection_ids", "type_id", "handle", "thumbnail", "is_giftcard", "discountable",
- "hs_code", "mid_code", "weight", "length", "height", "width", "origin_country", "vendor", "material",
- "created_at", "updated_at", "deleted_at", "tags", "status",
- },
- ln.SqlFieldSelection("title", ""),
- ln.SqlFieldSelection("subtitle", ""),
- 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", "product_id",
- "created_at", "updated_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...)
- }
- )
|