Documentation ¶
Index ¶
Constants ¶
View Source
const ( RedisBaseProductKey = "product_base" RedisProductRecommendKey = "product_recommend#%d" RedisProductSearchKey = "product_search#%s" RedisProductDetailKey = "product_detail#%d" )
Variables ¶
View Source
var ( RedisResponseType = ResponseType("Redis") PostgresResponseType = ResponseType("Postgres") ErrorResponseType = ResponseType("Error") )
Functions ¶
Types ¶
type Auth ¶
type Product ¶
type Product interface { CreateProduct(orm *gorm.DB, product *entity.Product) (*entity.Product, error) UpdateProductPhoto(orm *gorm.DB, id uint, fileName string) error GetBaseProducts(orm *gorm.DB, rc *redis.Client, limit int, offset int) ([]*entity.Product, ResponseType, error) FindProducts(orm *gorm.DB, rc *redis.Client, limit int, offset int, search string) ([]*entity.Product, ResponseType, error) FindProductByID(orm *gorm.DB, rc *redis.Client, id uint) (*entity.Product, ResponseType, error) GetProductRecommendFromRedis(rc *redis.Client, userID uint) ([]*entity.Product, error) SaveProductSearchToRedis(rc *redis.Client, search string, value interface{}, exp int) error SaveProductDetailToRedis(rc *redis.Client, id uint, value interface{}, exp int) error SaveBaseProductToRedis(rc *redis.Client, value interface{}, exp int) error SaveProductRecommendToRedis(rc *redis.Client, userID uint, value interface{}, exp int) error }
func NewProduct ¶
type ResponseType ¶
type ResponseType string
func (*ResponseType) String ¶
func (r *ResponseType) String() string
Click to show internal directories.
Click to hide internal directories.