Source → Stream → Sink without channel churn
Calling FromCSV, Filter, and Map creates immutable pull iterators over iter.Seq2. Synchronous chains execute inline on a single loop with zero background goroutines until an async boundary is needed.
err := automi.FromCSV(file, automi.SkipHeader()).
Filter(func(r []string) bool { return len(r) == 3 }).
Map(toNormalizedRow).
Into(ctx, automi.ToCSV(outWriter))
Wrap retries, breakers, and DLQs in reusable Steps
Do, Then, and Chain compose fallible transforms cleanly. Attach Retry, CircuitBreaker, and typed OnError dead-letter routing once, then run sequentially via TryMap or concurrently via ParMap.
enrich := automi.Do(fetchAccount).
Retry(3, 25*time.Millisecond, automi.Jitter(0.2)).
CircuitBreaker(5, 15*time.Second).
OnError(recordDeadLetter).
Then(automi.Chain(validateOrder, applyDiscount))
Bound workers, keep order, and flush on size or timer
ParMap and ParEach cap concurrent goroutines cleanly, recover panics into errors, and fall back inline with zero goroutines when configured with a single worker. Pair with Batch to flush full slices or partial windows after idle intervals.
ready := automi.FromLines(logs).
ParMap(enrich, automi.Workers(8), automi.Ordered())
err := automi.Batch(ready, automi.MaxSize(64), automi.MaxWait(200*time.Millisecond)).
Into(ctx, automi.ToFunc(bulkWrite))
Complete, Runnable Examples
Four self-contained Go programs showcasing end-to-end streaming patterns.
err := automi.FromCSV(strings.NewReader(csvData), automi.SkipHeader()).
ParMap(enrichStep, automi.Workers(4), automi.Ordered()).
Map(orderToCSVRow).
Into(ctx, automi.ToCSV(&out))
alertLogs := automi.Merge(automi.FromChan(east), automi.FromChan(west)).
BufferDrop(32, countDrop, automi.DropOldest()).
TryMap(parseAlertEntry).
RateLimit(200, automi.Burst(8))
err := automi.Batch(alertLogs, automi.MaxSize(2), automi.MaxWait(50*time.Millisecond)).
Into(ctx, automi.ToFunc(flushAlertBatch))
formatted := automi.FromChan(rawStates).
Debounce(35*time.Millisecond).
Map(formatAlertLine)
err := automi.FanOut(ctx, formatted,
automi.ToWriter[string](&auditLog),
automi.ToChan(alertCh, automi.CloseOnDone()),
)
discrepancies, err := automi.Zip(automi.FromSlice(invoices), automi.FromSeq(settlements)).
TryMap(compareInvoicePair).
GroupBy(ctx, func(d Discrepancy) string { return d.Region })
Explore the Documentation
Jump straight to guides, component manuals, runnable programs, or signature tables.