rest-api/model/product.go

26 lines
559 B
Go
Raw Permalink Normal View History

2020-09-29 22:35:59 +02:00
package model
import (
"github.com/Kamva/mgm/v3"
)
// Product type
type Product struct {
mgm.DefaultModel `bson:",inline"`
Name string `json:"name" bson:"name" validate:"required"`
Price float64 `json:"price" bson:"price" validate:"required"`
VAT int `json:"vat" bson:"vat" validate:"required"`
}
// Products Collection
type Products []Product
// NewProduct create new Product
func NewProduct(name string, price float64, vat int) *Product {
return &Product{
Name: name,
Price: price,
VAT: vat,
}
}