Documentation
¶
Overview ¶
Package forge-collection demonstrates forge collection operations applied to a batch of MQTT-style sensor temperature readings.
Use case: temperature sensors publish periodic readings. Our service receives batches of raw readings per sensor, filters out warm-up readings, maps each reading to a validated Celsius domain value, then reduces the batch to a summary (count, min, max, average). A final MapValues step processes all sensors at once.
forge collection operations used:
forge.Filter — discard readings from the sensor warm-up phase
forge.Map — convert each RawReading to a validated Celsius value
forge.Reduce — fold []Celsius → BatchSummary{Count, Min, Max, Avg}
forge.MapValues — apply the scalar pipeline per-key over map[string][]RawReading
All four return *forge.Function, making them composable, registerable in a Registry, and fully observable. The pipeline YAML spec shows kind/wraps fields.
Run with: go run ./examples/forge-collection
Click to show internal directories.
Click to hide internal directories.