storer

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

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLStorer

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

func NewMySQLStorer

func NewMySQLStorer(db *sqlx.DB) *MySQLStorer

func (*MySQLStorer) CreateProduct

func (ms *MySQLStorer) CreateProduct(ctx context.Context, p *Product) (*Product, error)

func (*MySQLStorer) DeleteProduct

func (ms *MySQLStorer) DeleteProduct(ctx context.Context, id int64) error

func (*MySQLStorer) GetProduct

func (ms *MySQLStorer) GetProduct(ctx context.Context, id int64) (*Product, error)

func (*MySQLStorer) ListProducts

func (ms *MySQLStorer) ListProducts(ctx context.Context) ([]*Product, error)

func (*MySQLStorer) UpdateProduct

func (ms *MySQLStorer) UpdateProduct(ctx context.Context, p *Product) (*Product, error)

type Product

type Product struct {
	ID           int64      `json:"id" db:"id"`
	Name         string     `json:"name" db:"name"`
	Image        string     `json:"image" db:"image"`
	Category     string     `json:"category" db:"category"`
	Description  string     `json:"description" db:"description"`
	Rating       int64      `json:"rating" db:"rating"`
	NumReviews   int64      `json:"num_reviews" db:"num_reviews"`
	Price        float32    `json:"price" db:"price"`
	CountInStock int64      `json:"count_in_stock" db:"count_in_stock"`
	CreatedAt    time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt    *time.Time `json:"updated_at" db:"updated_at"`
}

Jump to

Keyboard shortcuts

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