示例#1
0
文件: main.go 项目: mengjinglei/tools
func queryDB(con *client.Client, cmd string) (res []client.Result, err error) {
	q := client.Query{
		Command:  cmd,
		Database: MyDB,
	}
	if response, err := con.Query(q); err == nil {
		if response.Error() != nil {
			return res, response.Error()
		}
		res = response.Results
	}
	return
}
示例#2
0
文件: main.go 项目: mengjinglei/tools
func writePoints(con *client.Client, data []string) (ret string, err error) {

	bps := client.BatchPoints{
		TextPoints:      data,
		Database:        MyDB,
		RetentionPolicy: "default",
	}
	_, err = con.Write(bps)
	if err != nil {
		log.Fatal(err)
		ret = "write point failse"
	}

	return
}