Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AlphaNumerics = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ErrProductNotFound = fmt.Errorf("product not found") )
View Source
var (
ErrNoRatings = errors.New("no ratings for product")
)
View Source
var (
ErrStoreNotFound = errors.New("store not found")
)
Functions ¶
func GetProductReviewSummary ¶
func NewProductId ¶
Types ¶
type Product ¶
type Product struct { Id string `gorm:"primaryKey"` StoreId string Title string Slug string Description string // Category: should be written with hierarcy as 'Shoes->Sneakers' Category string // Tags: comma separated string, e.g. 'shoes,sneakers,running' Tags string // Price: in IDR; if product has variant, then this is the lowest price Price int64 // Stock: if product has no variant, then this is the actual stock Stock int64 TotalViews int64 CreatedAt int64 `gorm:"autoCreateTime:milli"` UpdatedAt int64 `gorm:"autoUpdateTime:milli"` Variants []*ProductVariantGroup `gorm:"-"` AverageRating float64 `gorm:"-"` TotalReview int64 `gorm:"-"` TotalSold int64 `gorm:"-"` }
func GetAllProductsBySearch ¶
func GetAllProductsByStore ¶
type ProductReview ¶
type ProductReview struct { Id uint `gorm:"primaryKey"` ProductId string UserId string Comment string Rating int CreatedAt int64 `gorm:"autoCreateTime:milli"` Media []*ProductReviewMedia `gorm:"foreignKey:ReviewId"` }
func GetProductReviews ¶
func GetProductReviews(db *gorm.DB, productId string) ([]*ProductReview, error)
type ProductReviewMedia ¶
type ProductVariant ¶
type ProductVariant struct { Id uint `gorm:"primaryKey"` ProductId string Name string Value string Price int64 Stock int64 CreatedAt int64 `gorm:"autoCreateTime:milli"` UpdatedAt int64 `gorm:"autoUpdateTime:milli"` }
ProductVariant represents data in db
type ProductVariantGroup ¶
type ProductVariantGroup struct { // Name: Type or Title of variant, e.g. Color, Size, etc. Name string // Values: Array of actual values, e.g. [Red, Blue, Green] or [S, M, L] Values []*VariantItem }
type Store ¶
type VariantItem ¶
Click to show internal directories.
Click to hide internal directories.