Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorProductNotFound = fmt.Errorf("Product not found")
ErrorProductNotFound : Product specific errors
Functions ¶
This section is empty.
Types ¶
type Product ¶
type Product struct { ID string `json:"id" bson:"_id"` Name string `json:"name" validate:"required"` Description string `json:"description"` Price float32 `json:"price" validate:"gt=0"` SKU string `json:"sku" validate:"required,sku"` CreatedOn string `json:"-"` UpdatedOn string `json:"-"` }
Product defines the structure for an API product. Formatting done with json tags to the right. "-" : don't include when encoding to json
func (*Product) ValidateProduct ¶
ValidateProduct a product with json validation and customer SKU validator
Click to show internal directories.
Click to hide internal directories.