//GetAllPrices gets all the prices
GetAllPrices gets all the prices
// GetAllPrices gets all the prices
func (db *Db) GetAllPrices() ([]model.Price, error) {
	rows, err := db.conn.Query("SELECT * FROM price;")
	if err != nil {
		log.Errorf("db: %s\n", err)
	}
	defer rows.Close()
	var prices []model.Price
	for rows.Next() {
		var price model.Price
		scanErr := rows.Scan(&price.ID, &price.Date, &price.ProductID, &price.Hinta)
		if scanErr != nil {
			log.Errorf("db: %s\n", scanErr)
		}
		prices = append(prices, price)
	}
	if err = rows.Err(); err != nil {
		log.Errorf("db: %s\n", err)
	}
	return prices, nil
}
func ( db * Db ) GetAllPrices ( ) ( [ ] model . Price , error ) { rows , err := db . conn . Query ( " " ) if err != nil { log . Errorf ( " \n " , err ) } defer rows . Close ( ) var prices [ ] model . Price for rows . Next ( ) { var price model . Price scanErr := rows . Scan ( & price . ID , & price . Date , & price . ProductID , & price . Hinta ) if scanErr != nil { log . Errorf ( " \n " , scanErr ) } prices = append ( prices , price ) } if err = rows . Err ( ) ; err != nil { log . Errorf ( " \n " , err ) } return prices , nil }
GetAllPrices gets all the prices
GetAllPrices gets all the prices