Documentation ¶
Index ¶
- type RatingRepository
- func (r *RatingRepository) Amounts(ctx context.Context) (*domain.RatingAmounts, error)
- func (r *RatingRepository) Average(ctx context.Context) (*domain.RatingAverage, error)
- func (r *RatingRepository) AverageByProductID(ctx context.Context, pid int) (*domain.RatingAverage, error)
- func (r *RatingRepository) Breakdown(ctx context.Context) ([]*domain.RatingBreakdown, error)
- func (r *RatingRepository) BreakdownByProductID(ctx context.Context, pid int) ([]*domain.RatingBreakdown, error)
- func (r *RatingRepository) Count(ctx context.Context) (int64, error)
- func (r *RatingRepository) CountByProductID(ctx context.Context, pid int) (int64, error)
- func (r *RatingRepository) Delete(ctx context.Context, rating *domain.Rating) error
- func (r *RatingRepository) Get(ctx context.Context, id int) (*domain.Rating, error)
- func (r *RatingRepository) Inject(db db.DB)
- func (r *RatingRepository) List(ctx context.Context) ([]*domain.Rating, error)
- func (r *RatingRepository) ListByProductID(ctx context.Context, pid int) ([]*domain.Rating, error)
- func (r *RatingRepository) Save(ctx context.Context, rating *domain.Rating) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RatingRepository ¶
type RatingRepository struct {
// contains filtered or unexported fields
}
RatingRepository implements the MySQL connection for Rating persistence
func (*RatingRepository) Amounts ¶
func (r *RatingRepository) Amounts(ctx context.Context) (*domain.RatingAmounts, error)
Amounts returns a map of product IDs an the corresponding number of ratings
func (*RatingRepository) Average ¶
func (r *RatingRepository) Average(ctx context.Context) (*domain.RatingAverage, error)
Average returns the average statistics of all data
func (*RatingRepository) AverageByProductID ¶
func (r *RatingRepository) AverageByProductID(ctx context.Context, pid int) (*domain.RatingAverage, error)
AverageByProductID returns the average statistics of all data for a specific product ID
func (*RatingRepository) Breakdown ¶
func (r *RatingRepository) Breakdown(ctx context.Context) ([]*domain.RatingBreakdown, error)
Breakdown returns the statistics by single stars
func (*RatingRepository) BreakdownByProductID ¶
func (r *RatingRepository) BreakdownByProductID(ctx context.Context, pid int) ([]*domain.RatingBreakdown, error)
BreakdownByProductID returns the statistics by single stars for a given product
func (*RatingRepository) Count ¶
func (r *RatingRepository) Count(ctx context.Context) (int64, error)
Count returns the number of all ratings
func (*RatingRepository) CountByProductID ¶
CountByProductID returns the number of all ratings for a given product ID
func (*RatingRepository) ListByProductID ¶
ListByProductID returns all ratings for a given product ID
Click to show internal directories.
Click to hide internal directories.