Modeling product data

We have defined the Product struct in the shared/models/product.go source file to model product data:

package models

type Product struct {
SKU string
Name string
Description string
ThumbnailPreviewURI string
ImagePreviewURI string
Price float64
Route string
SummaryDetail string
Quantity int
}

The SKU field represents the product's stock keeping unit (SKU), a unique id that represents the product. In the sample data set provided, we use incrementing integer values, however, this field is of the string type to accommodate alphanumeric SKUs in the future for extensibility. The Name field represents the name of the product. The Description field represents the short description that will be included in the products listing page. The ThumbnailPreviewURI field provides the path to the thumbnail image of the product. The Price field represents the price of the product and is of the float64 type. The Route field is the server relative path to the product detail page for the given product. The SummaryDetail field represents the long description for the product that will be displayed in the product detail page. Finally, the Quantity field, which is of the int type, is the quantity of the particular product item that is presently in the shopping cart. We will be making use of this field in the next chapter, when we implement the shopping cart functionality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.47.218