123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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...)
- }
- )
|