product.go 928 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package db
  2. import (
  3. "github.com/gshopify/service-wrapper/model"
  4. "gshopper.com/gshopify/products/cache"
  5. "time"
  6. )
  7. var (
  8. productKey = func(clause string, args ...any) *cache.SqlKey {
  9. return cache.NewSQLKey(
  10. "product",
  11. time.Minute,
  12. clause,
  13. args...,
  14. )
  15. }
  16. productSelection = func(ln model.LanguageCode) []string {
  17. return append([]string{
  18. "id", "profile_id", "collection_ids", "type_id", "handle", "thumbnail", "is_giftcard", "discountable",
  19. "hs_code", "mid_code", "weight", "length", "height", "width", "origin_country", "vendor", "material",
  20. "created_at", "updated_at", "deleted_at", "tags", "status",
  21. },
  22. ln.SqlFieldSelection("title"),
  23. ln.SqlFieldSelection("subtitle"),
  24. ln.SqlFieldSelection("description"),
  25. )
  26. }
  27. productCollectionKey = func(clause string, args ...any) *cache.SqlKey {
  28. return cache.NewSQLKey(
  29. "product_collection",
  30. 3*time.Minute,
  31. clause,
  32. args...,
  33. )
  34. }
  35. )