fix(go): project full yutong mqtt data to realtime kv
This commit is contained in:
@@ -90,7 +90,13 @@ func realtimeKVFields(env envelope.FrameEnvelope, parsed map[string]any) []Realt
|
||||
}
|
||||
rows = add(rows, "location", fields)
|
||||
case envelope.ProtocolYutongMQTT:
|
||||
rows = add(rows, "vehicle", cloneFields(env.Fields))
|
||||
fields := cloneFields(env.Fields)
|
||||
if data, ok := parsed["data"].(map[string]any); ok {
|
||||
for key, value := range data {
|
||||
fields[key] = value
|
||||
}
|
||||
}
|
||||
rows = add(rows, "vehicle", fields)
|
||||
}
|
||||
return rows
|
||||
}
|
||||
@@ -171,6 +177,8 @@ func stringifyKVValue(value any) (string, string, bool) {
|
||||
return strconv.FormatFloat(typed, 'f', -1, 64), "number", true
|
||||
case float32:
|
||||
return strconv.FormatFloat(float64(typed), 'f', -1, 64), "number", true
|
||||
case json.Number:
|
||||
return typed.String(), "number", strings.TrimSpace(typed.String()) != ""
|
||||
case int:
|
||||
return strconv.Itoa(typed), "number", true
|
||||
case int8, int16, int32, int64:
|
||||
|
||||
Reference in New Issue
Block a user