// Update updates the specified product in the system.
Update updates the specified product in the system.
// Update updates the specified product in the system .
func (p *Product) Update(ctx context.Context, log *log.Logger, w http.ResponseWriter, r *http.Request, params map[string]string) error {
	ctx, span := trace.StartSpan(ctx, "handlers.Product.Update")
	defer span.End()
	dbConn := p.MasterDB.Copy()
	defer dbConn.Close()
	v := ctx.Value(web.KeyValues).(*web.Values)
	var up product.UpdateProduct
	if err := web.Unmarshal(r.Body, &up); err != nil {
		return errors.Wrap(err, "")
	}
	err := product.Update(ctx, dbConn, params["id"], up, v.Now)
	if err = translate(err); err != nil {
		return errors.Wrapf(err, "ID: %s Update: %+v", params["id"], up)
	}
	web.Respond(ctx, log, w, nil, http.StatusNoContent)
	return nil
}
func ( p * Product ) Update ( ctx context . Context , log * log . Logger , w http . ResponseWriter , r * http . Request , params map [ string ] string ) error { ctx , span := trace . StartSpan ( ctx , " " ) defer span . End ( ) dbConn := p . MasterDB . Copy ( ) defer dbConn . Close ( ) v := ctx . Value ( web . KeyValues ) . ( * web . Values ) var up product . UpdateProduct if err := web . Unmarshal ( r . Body , & up ) ; err != nil { return errors . Wrap ( err , " " ) } err := product . Update ( ctx , dbConn , params [ " " ] , up , v . Now ) if err = translate ( err ) ; err != nil { return errors . Wrapf ( err , " " , params [ " " ] , up ) } web . Respond ( ctx , log , w , nil , http . StatusNoContent ) return nil }
Update updates the specified product in the system.
Update updates the specified product in the system .