stats

package
v0.0.0-...-b0e2d2c Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ProductStatsTableName = "product_stats"

Variables

This section is empty.

Functions

This section is empty.

Types

type ProductStats

type ProductStats struct {
	ProductId        int64           `db:"product_id" json:"productId"`
	Price            int             `db:"price" json:"price"`
	Difference       int             `db:"difference" json:"difference"`
	DiscountPercent  decimal.Decimal `db:"discount_percent" json:"discount_percent"`
	Average          decimal.Decimal `db:"average" json:"average"`
	Minimum          int             `db:"minimum" json:"minimum"`
	Maximum          int             `db:"maximum" json:"maximum"`
	MetricEntryCount int             `db:"entries" json:"entries"`
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(db *sql.DB) *Repository

func (*Repository) CreateProductStats

func (r *Repository) CreateProductStats(
	productId int64, price, minimum, maximum, count int, difference, discountPercent, average decimal.Decimal, tx *sql.Tx,
) error

func (*Repository) FindByProductId

func (r *Repository) FindByProductId(productId int64, tx *sql.Tx) (*ProductStats, error)

func (*Repository) HasProductStats

func (r *Repository) HasProductStats(productId int64, tx *sql.Tx) (bool, error)

func (*Repository) UpdateProductStats

func (r *Repository) UpdateProductStats(
	productId int64, price, minimum, maximum, count int, difference, discountPercent, average decimal.Decimal, tx *sql.Tx,
) error

Jump to

Keyboard shortcuts

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