コード例 #1
0
ファイル: statcap.go プロジェクト: dustin/statcap
// Get stats, converting as many values to numbers as possible.
// ...unless there's no connection, in which case we'll return empty stats.
func getNumericStats(client fetcher, which string) (rv map[string]interface{}) {
	if client == nil {
		rv = make(map[string]interface{})
	} else {
		rv = mapconv.Numerify(client.StatsMap(which))
	}
	return
}
コード例 #2
0
ファイル: main.go プロジェクト: dustin/statcap
// Get stats, converting as many values to numbers as possible.
// ...unless there's no connection, in which case we'll return empty stats.
func getNumericStats(client fetcher, which string) (rv map[string]map[string]interface{}) {
	rv = make(map[string]map[string]interface{})

	if client != nil {
		tmp := client.GetStats(which)
		for k, v := range tmp {
			rv[k] = mapconv.Numerify(v, nil)
		}
	}
	return
}