database.go 1.1 KB

123456789101112131415161718192021222324252627282930
  1. package db
  2. import (
  3. "github.com/gshopify/service-wrapper/model"
  4. "github.com/gshopify/service-wrapper/server/middleware"
  5. "gshopper.com/gshopify/products/graphql/generated"
  6. "time"
  7. )
  8. const (
  9. cacheTimeout = time.Hour
  10. cacheCapacity = 4096
  11. )
  12. type Database interface {
  13. Ping() error
  14. Close() error
  15. Product(ln model.LanguageCode, handle *string, id *string) (*generated.Product, error)
  16. Products(ln model.LanguageCode, collectionId *string) ([]*generated.Product, error)
  17. ProductOptions(ln model.LanguageCode, id string) ([]*generated.ProductOption, error)
  18. ProductVariants(ctx *middleware.GShopifyContext, id string) ([]*generated.ProductVariant, error)
  19. ProductVariantOptions(ln model.LanguageCode, id string) ([]*generated.SelectedOption, error)
  20. ProductTags() ([]*model.ProductTag, error)
  21. ProductTypes() ([]*model.ProductType, error)
  22. Collection(ln model.LanguageCode, handle *string, id *string) (*generated.Collection, error)
  23. Collections(ln model.LanguageCode) ([]*generated.Collection, error)
  24. ProductCollections(ln model.LanguageCode, id string) ([]*generated.Collection, error)
  25. }