Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

What about the records that fail?

Available — v0.0.1 (experimental)starlark

More than one output

Good orders go to one stream, orders that cannot be processed to another. Errors are data you route, not log lines you grep.

Available in v0.0.1: the files, README and tests are in examples/starlark-transform of the openflange-go repository. Commands run from the repository root.

Needs: only the openflange CLI.

A pipe is a data-processing step with declared inputs and outputs.

What goes in, what comes out

Input (stdin)
{"id":1,"lines":[{"sku":"a","qty":2,"cents":1250}]}
{"id":2,"lines":[]}
Command
printf '%s\n' '{"id":1,"lines":[{"sku":"a","qty":2,"cents":1250}]}' '{"id":2,"lines":[]}' | openflange run ./examples/starlark-transform --output totals=- --output rejected=rejected.ndjson
Outputs
# totals (stdout)
{"id":1,"items":2,"totalCents":2500,"currency":"EUR"}
# rejected.ndjson
{"order":{"id":2,"lines":[]},"reason":"no lines"}

Files and further commands

If nobody connects `rejected` (exit status 1)
E_RUNTIME: item 1: malformed order (no lines) and the rejected output is not connected (node order-totals)

What to notice

  • The pipe is the Starlark script of the Starlark example. --output totals=- sends the main output to stdout and --output rejected=rejected.ndjson binds the second one to a file.
  • rejected is an optional output. Connect it and bad records arrive there with a reason. Leave it unconnected and the first bad record fails the run. Nothing is silently dropped either way.
  • Unix pipes stop at one stdin and one stdout. Named ports are what make a second output possible without a framework.