Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProductRepository ¶
type ProductRepository interface { List(ctx context.Context) ([]*Product, error) Get(ctx context.Context, id int) (*Product, error) }
ProductRepository can retrieve product information
type Rating ¶
type Rating struct { ID int `db:"id"` UserName string `db:"name"` ProductID int `db:"product_id"` CreatedAt time.Time `db:"created_at"` Title string `db:"title"` Text string `db:"text"` Stars int `db:"stars"` }
Rating represents a single product rating
type RatingAmounts ¶
RatingAmounts represents the number of ratings by product ID
type RatingAverage ¶
RatingAverage represents the mean of a set of ratings
type RatingBreakdown ¶
RatingBreakdown represents the amount of n-stars ratings for a set of ratings
type RatingRepository ¶
type RatingRepository interface { Count(ctx context.Context) (int64, error) CountByProductID(ctx context.Context, pid int) (int64, error) List(ctx context.Context) ([]*Rating, error) ListByProductID(ctx context.Context, pid int) ([]*Rating, error) Get(ctx context.Context, id int) (*Rating, error) Save(ctx context.Context, rating *Rating) error Delete(ctx context.Context, rating *Rating) error Amounts(ctx context.Context) (*RatingAmounts, error) Average(ctx context.Context) (*RatingAverage, error) AverageByProductID(ctx context.Context, pid int) (*RatingAverage, error) Breakdown(ctx context.Context) ([]*RatingBreakdown, error) BreakdownByProductID(ctx context.Context, pid int) ([]*RatingBreakdown, error) }
RatingRepository provides all functions for Rating storage
Click to show internal directories.
Click to hide internal directories.