utilities.go
func ParseAllRows(rows ObjectRows, done chan bool) (results []interface{}, err error) {
	defer rows.Close()
	ok := false
	for {
		select {
		case <-done:
			logger.Info("done")
			return
		default:

			var element interface{}
			ok, err = rows.Next(&element)
			if err != nil {
				logger.Error("error retrieving row", "err", err)
				return
			}
			logger.Info("element", "el", element)
			if ok {
				logger.Info("next element", "el", element)
				results = append(results, element)

			} else {
				if err != nil {
					logger.Warn("Error retrieving rows", "err", err)
				}
				return
			}
		}
	}
	return
}
func ParseAllRows(rows ObjectRows, done chan bool) (results []interface{}, err error) {
	defer rows.Close()
	ok := false
	for {
		select {
		case <-done:
			logger.Info("done")
			return
		default:

			var element interface{}
			ok, err = rows.Next(&element)
			if err != nil {
				logger.Error("error retrieving row", "err", err)
				return
			}
			logger.Info("element", "el", element)
			if ok {
				logger.Info("next element", "el", element)
				results = append(results, element)

			} else {
				if err != nil {
					logger.Warn("Error retrieving rows", "err", err)
				}
				return
			}
		}
	}
	return
}
func ParseAllRows ( rows ObjectRows , done chan bool ) ( results [ ] interface { } , err error ) { defer rows . Close ( ) ok := false for { select { case <- done : logger . Info ( " " ) return default : var element interface { } ok , err = rows . Next ( & element ) if err != nil { logger . Error ( " " , " " , err ) return } logger . Info ( " " , " " , element ) if ok { logger . Info ( " " , " " , element ) results = append ( results , element ) } else { if err != nil { logger . Warn ( " " , " " , err ) } return } } } return }
// func IterRows(rows ObjectRows, eachFunc func(), done chan bool) (err error) {
// 	defer rows.Close()
// 	ok := false
// 	for {
// 		select {
// 		case <-done:
// 			logger.Info("done")
// 			return
// 		default:
// 			var element interface{}
// 			ok, err = rows.Next(&element)
// 			if err != nil {
// 				logger.Error("error retrieving row", "err", err)
// 				return
// 			}
// 			logger.Info("element", "el", element)
// 			if ok {
// 				logger.Info("next element", "el", element)
// 				results = append(results, element)
// 			} else {
// 				if err != nil {
// 					logger.Warn("Error retrieving rows", "err", err)
// 				}
// 				return
// 			}
// 		}
// 	}
// 	return
// }
func IterRows ( rows ObjectRows eachFunc func () done chan bool ) ( err error ) { defer rows . Close () ok : = false for { select { case < - done : logger . Info ( done ) return default : var element interface {} ok err = rows . Next ( &element ) if err ! = nil { logger . Error ( error retrieving row err err ) return } logger . Info ( element el element ) if ok { logger . Info ( next element el element ) results = append ( results element ) } else { if err ! = nil { logger . Warn ( Error retrieving rows err err ) } return } } } return }