repository

package
v0.0.0-...-9eb387d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 9 Imported by: 0

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

func Register

func Register(container *dig.Container) error

Types

type Auth

type Auth interface {
	FindUserByEmail(orm *gorm.DB, email string) (*entity.User, error)
	CreateUser(orm *gorm.DB, user *entity.User) (*entity.User, error)
	UpdateUserVerified(orm *gorm.DB, code string) (*entity.User, error)
}

func NewAuth

func NewAuth() (Auth, error)

type Holder

type Holder struct {
	dig.In
	Auth    Auth
	Product Product
}

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

func NewProduct() (Product, error)

type ResponseType

type ResponseType string

func (*ResponseType) String

func (r *ResponseType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL