forge-collection

command
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 15 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL