func Data(w http.ResponseWriter, req *http.Request) {
	w.Header().Set("Content-Type", "text/html")
	node := req.FormValue("node")
	if node == "" {
		node = "node"
	}
	for _, child := range ChildNodes(node) {
		response := fmt.Sprintf("<h3>%s</h3><br/>", child)
		w.Write([]byte(response))
		w.Write([]byte("<ul>"))
		response = ZmqRead("tsds", fmt.Sprintf("%s:%s", node, child))
		hmap := golhashmap.Csv_to_hashmap(response)
		for key, val := range hmap {
			stats := fmt.Sprintf("<li>%s: <b>%s</b></li>", key, val)
			w.Write([]byte(stats))
		}
		w.Write([]byte("</ul>"))
	}
}
Example #2
0
/* handles multi-item */
func PushKeyValMulti(task_type string, multi_type string, message_array *[]string) bool {
	var hashmap_key_value golhashmap.HashMap
	multi_value := strings.Join((*message_array)[6:], "\n")

	switch multi_type {
	case "csv":
		hashmap_key_value = golhashmap.Csv_to_hashmap(multi_value)

	/*make multi_type sent to golhashmap and get converter, pass multi_value and get hashmap*/
	//case "json":
	//	hashmap_key_value = golhashmap.Json_to_hashmap(multi_value)

	default:
		return false
	}

	status := true
	for _key, _val := range hashmap_key_value {
		_val = strings.Replace(_val, "\n", " ", -1)
		status = status && PushKeyValSolo(task_type, _key, _val, message_array)
	}
	return status
}