/*
Handles Packet formation: DBData based on ValType for GET|DELETE
*/
func decodeKeyData(valType string, message_array []string) []string {
	switch valType {
	case "csv", "json":
		multi_value := strings.Join(message_array, "\n")
		listEngine := gollist.GetListEngine(valType)
		return listEngine.ToList(multi_value)

	default:
		return []string{message_array[0]}
	}
}
Exemplo n.º 2
0
/* formulate dbdata for non-default val-type FOR dbDataFromPacket */
func dbDataForEncodedVal(packet *goshare.Packet) (dbdata string) {
	switch packet.DBAction {
	case "push":
		hmap_engine := golhashmap.GetHashMapEngine(packet.ValType)
		dbdata = hmap_engine.FromHashMap(packet.HashMap)
	case "read", "delete":
		list_engine := gollist.GetListEngine(packet.ValType)
		dbdata = list_engine.FromList(packet.KeyList)
	default:
		//to-be-log
	}
	return dbdata
}