//CreatePrices creates new prices for juomas
CreatePrices creates new prices for juomas
// CreatePrices creates new prices for juomas
func (db *Db) CreatePrices(drinks *[]exel.Drink) (OK bool, error error) {
	defer helpers.Duration(time.Now(), "insertPrices")
	stmp, stmpErr := db.conn.Prepare("INSERT INTO price (Date, ProductID, Hinta) VALUES ($1, $2, $3)")
	if stmpErr != nil {
		return false, stmpErr
	}
	defer stmp.Close()
	for _, drink := range *drinks {
		_, err := stmp.Exec(drink.Date, drink.ProductID, drink.Hinta)
		if err != nil {
			return false, err
		}
	}
	return true, nil
}
func ( db * Db ) CreatePrices ( drinks * [ ] exel . Drink ) ( OK bool , error error ) { defer helpers . Duration ( time . Now ( ) , " " ) stmp , stmpErr := db . conn . Prepare ( " " ) if stmpErr != nil { return false , stmpErr } defer stmp . Close ( ) for _ , drink := range * drinks { _ , err := stmp . Exec ( drink . Date , drink . ProductID , drink . Hinta ) if err != nil { return false , err } } return true , nil }
CreatePrices creates new prices for juomas
CreatePrices creates new prices for juomas