//SearchForDrink gets one or more juoma based on search results
SearchForDrink gets one or more juoma based on search results
// SearchForDrink gets one or more juoma based on search results
func (db *Db) SearchForDrink(term string) (j []model.Drink, error error) {
	qstr := fmt.Sprintf("SELECT * FROM drink WHERE nimi ILIKE '%%%s%%' OR tyyppi ILIKE '%%%s%%'", term, term)
	rows, err := db.conn.Query(qstr)
	defer rows.Close()
	if err != nil {
		log.Errorf("db: failed to find juoma: %v\n", err)
	}
	drinks, scanErr := scanDrinks(rows)
	if scanErr != nil {
		log.Errorf("db: failed to scan drinks: %v\n", err)
	}
	return drinks, nil
}
func ( db * Db ) SearchForDrink ( term string ) ( j [ ] model . Drink , error error ) { qstr := fmt . Sprintf ( " " , term , term ) rows , err := db . conn . Query ( qstr ) defer rows . Close ( ) if err != nil { log . Errorf ( " \n " , err ) } drinks , scanErr := scanDrinks ( rows ) if scanErr != nil { log . Errorf ( " \n " , err ) } return drinks , nil }
SearchForDrink gets one or more juoma based on search results
SearchForDrink gets one or more juoma based on search results