//InsertManyDrinks reads the alko file and inserts everything to postgres
InsertManyDrinks reads the alko file and inserts everything to postgres
// InsertManyDrinks reads the alko file and inserts everything to postgres
func (db *Db) InsertManyDrinks() (string, error) {
	val, err := exel.ReadXlsx(exel.FileLocation)
	if err != nil {
		log.Errorf("db: %s", err)
		return "err during exel read", err
	}
	var wg sync.WaitGroup
	wg.Add(1)
	go func(wg *sync.WaitGroup) {
		defer wg.Done()
		OK, jerr := db.InsertDrinks(&val)
		if !OK {
			log.Errorf("db: %s", jerr)
		}
	}(&wg)
	wg.Add(1)
	go func(wg *sync.WaitGroup) {
		defer wg.Done()
		OK2, herr := db.CreatePrices(&val)
		if !OK2 {
			log.Fatal(herr)
		}
	}(&wg)
	wg.Wait()
	return "OK", nil
}
func ( db * Db ) InsertManyDrinks ( ) ( string , error ) { val , err := exel . ReadXlsx ( exel . FileLocation ) if err != nil { log . Errorf ( " " , err ) return " " , err } var wg sync . WaitGroup wg . Add ( 1 ) go func ( wg * sync . WaitGroup ) { defer wg . Done ( ) OK , jerr := db . InsertDrinks ( & val ) if ! OK { log . Errorf ( " " , jerr ) } } ( & wg ) wg . Add ( 1 ) go func ( wg * sync . WaitGroup ) { defer wg . Done ( ) OK2 , herr := db . CreatePrices ( & val ) if ! OK2 { log . Fatal ( herr ) } } ( & wg ) wg . Wait ( ) return " " , nil }
InsertManyDrinks reads the alko file and inserts everything to postgres
InsertManyDrinks reads the alko file and inserts everything to postgres