rest-api/model/product.go
Piotr Biernat 27222a479e
All checks were successful
continuous-integration/drone/push Build is passing
Added base RabbitMQ queue support
2020-09-29 23:41:05 +02:00

26 lines
559 B
Go

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,
}
}