Documentation
¶
Overview ¶
Package parser provides pluggable parsing of incoming transport payloads (MQTT messages, HTTP webhook bodies) into core.DataPoint values.
Different transport sources speak different wire formats, so different parsers are needed. The "default" parser handles CoreC→CoreC chaining (both sides share the same DataPoint JSON schema); "jsonpath" maps arbitrary JSON fields onto DataPoint via configurable templates; "raw" treats the entire payload as a scalar value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
Parser converts a raw payload (and optional MQTT topic for context) into a DataPoint. Parse is called once per incoming message.
func New ¶
New creates a Parser from a settings map. Recognised keys:
parser.type "default" | "jsonpath" | "raw" (default: "default") parser.driver static string for driver field parser.tag template or static string parser.value template path (jsonpath) — for "raw" ignored parser.type-field template or static for DataType parser.group static string parser.device static string parser.timestamp template path parser.timestamp-format "rfc3339" | "unix" | "unixmilli" (default: "rfc3339")
When parser.type is absent or "default", the parser is a straight json.Unmarshal into DataPoint — the zero-cost path for CoreC→CoreC.