data

package
v0.0.0-...-34d2590 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 3 Imported by: 0

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

func (product *Product) ValidateProduct() error

ValidateProduct a product with json validation and customer SKU validator

type Products

type Products []*Product

Products is a collection of Product

Jump to

Keyboard shortcuts

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