infrastructure

package
v0.0.0-...-6f8c8e2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

Amounts returns a map of product IDs an the corresponding number of ratings

func (*RatingRepository) Average

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

func (r *RatingRepository) CountByProductID(ctx context.Context, pid int) (int64, error)

CountByProductID returns the number of all ratings for a given product ID

func (*RatingRepository) Delete

func (r *RatingRepository) Delete(ctx context.Context, rating *domain.Rating) error

Delete the given rating

func (*RatingRepository) Get

func (r *RatingRepository) Get(ctx context.Context, id int) (*domain.Rating, error)

Get returns a specific rating

func (*RatingRepository) Inject

func (r *RatingRepository) Inject(db db.DB)

Inject dependencies

func (*RatingRepository) List

func (r *RatingRepository) List(ctx context.Context) ([]*domain.Rating, error)

List off all Ratings

func (*RatingRepository) ListByProductID

func (r *RatingRepository) ListByProductID(ctx context.Context, pid int) ([]*domain.Rating, error)

ListByProductID returns all ratings for a given product ID

func (*RatingRepository) Save

func (r *RatingRepository) Save(ctx context.Context, rating *domain.Rating) error

Save creates or updates a given rating based on its ID

Jump to

Keyboard shortcuts

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