Documentation ¶
Index ¶
- type MySQLStorer
- func (ms *MySQLStorer) CreateProduct(ctx context.Context, p *Product) (*Product, error)
- func (ms *MySQLStorer) DeleteProduct(ctx context.Context, id int64) error
- func (ms *MySQLStorer) GetProduct(ctx context.Context, id int64) (*Product, error)
- func (ms *MySQLStorer) ListProducts(ctx context.Context) ([]*Product, error)
- func (ms *MySQLStorer) UpdateProduct(ctx context.Context, p *Product) (*Product, error)
- type Product
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 (*MySQLStorer) DeleteProduct ¶
func (ms *MySQLStorer) DeleteProduct(ctx context.Context, id int64) error
func (*MySQLStorer) GetProduct ¶
func (*MySQLStorer) ListProducts ¶
func (ms *MySQLStorer) ListProducts(ctx context.Context) ([]*Product, error)
func (*MySQLStorer) UpdateProduct ¶
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"` }
Click to show internal directories.
Click to hide internal directories.