func processResults()

in scripts/go/costcli/costcli.go [234:256]


func processResults(resp AthenaResponse, c Config) Results {

	r := &Results{
		tagCosts: make(map[string]float64),
		total:    0,
	}

	for _, row := range resp.Rows {
		f, err := strconv.ParseFloat(row["cost"], 64)
		if err != nil {
			fmt.Println("Failed to convert float, continuing")
			continue
		}

		tags := []string{row["service"]}
		for _, tm := range c.TagMap {
			tags = append(tags, findTagMatch(row[tm.Tag], tm.Map))
		}
		r.tagCosts[strings.Join(tags, ",")] += f
		r.total += f
	}
	return *r
}