Documentation ¶
Overview ¶
Apache v2 license
* Copyright (C) <2019> Intel Corporation * * SPDX-License-Identifier: Apache-2.0
Apache v2 license
* Copyright (C) <2019> Intel Corporation * * SPDX-License-Identifier: Apache-2.0
Apache v2 license
* Copyright (C) <2019> Intel Corporation * * SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
const DbSchema = `` /* 210-byte string literal not displayed */
DbSchema postgresql db schema
const Schema = `` /* 1924-byte string literal not displayed */
Schema represents the schema for input data for RESTFul POST API
Variables ¶
This section is empty.
Functions ¶
func GroupBySku ¶
GroupBySku creates a map of SKUData with sku as key and groups same sku object.
Types ¶
type CountType ¶
type CountType struct {
Count int `json:"count"`
}
CountType is used to hold the total count
type IncomingData ¶
type IncomingData struct { // the Broker calls this `upc`, even though it could be any type of product ID ProductID string `json:"upc"` SKU string `json:"sku"` BeingRead float64 `json:"beingRead"` BecomingReadable float64 `json:"becomingReadable"` ExitError float64 `json:"exitError"` DailyTurn float64 `json:"dailyTurn"` Metadata map[string]interface{} `json:"metadata"` }
IncomingData represents the struct of the raw data coming from the Broker.
Although it may have the same "shape" as the ProductData, the json attributes may be different, but must be correctly mapped to the database model.
type ProductData ¶
type ProductData struct { // ProductID is the "formal" ID for a product, often a GTIN ProductID string `json:"productId" db:"productId"` BeingRead float64 `json:"beingRead" db:"beingRead"` BecomingReadable float64 `json:"becomingReadable" db:"becomingReadable"` ExitError float64 `json:"exitError" db:"exitError"` DailyTurn float64 `json:"dailyTurn" db:"dailyTurn"` // Metadata stores arbitrary data about a product Metadata map[string]interface{} `json:"metadata"` }
ProductData models the product's attributes
type Root ¶
type Root struct { //in: body Data []SKUData `json:"data"` }
Root - Main struct for input swagger:parameters postSkus
type SKUData ¶
type SKUData struct { // SKU represents an identifier a business uses for a product or collection of products SKU string `json:"sku" db:"sku"` // ProductList connects one or more products to the same SKU ProductList []ProductData `json:"productList" db:"productList"` }
SKUData connects a SKU to its list of products
func GetProductMetadata ¶
GetProductMetadata receives a product ID (upc) and looks up and returns the corresponding metadata