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.

TransformExperimental

std:limit #

Emits at most the first count items.

For example: try a pipeline on the first 100 records.

A pipe is a data processing step with declared inputs and outputs; standard pipes are built into the runner.

Ports #

std:limit takes in and produces out.std:limitinrecordsoutrecords
std:limit takes in and produces out.std:limitinrecordsoutrecords
Named ports from the latest published contract. Dashed lines are optional ports.
Ports of std:limit
PortDirectionKindRequiredDescription
ininputrecordsyes
outoutputrecordsyes

Parameters #

Parameters of std:limit
NameTypeDefaultRequiredDescription
countintegernoneyes Minimum 0.

When to use it #

  • Run a new pipeline on a small sample of a large input before running it on everything.
  • Together with std:skip, take one page of a stream: skip 200, then limit 100.

When to use something else

  • It counts records and does not look at them: to choose records by a condition use std:filter. The rest of the input is consumed and discarded, and the run completes normally.

A tested example #

Nothing here is invented: this is the test “first two” from the pipe's own portable test file, which every conformant runner must pass.

Parameters
{
  "count": 2
}
Input: in
"a"
"b"
"c"
Expected output: out
"a"
"b"

The same step as a node of a pipeline.yaml:

pipeline.yaml
nodes:
  limit:
    pipe: std:limit
    inputs:
      in: {from: inputs.in}
    parameters:
      count: 2

Run it #

The pipe runs on its own from a shell. The input is the test input above. The quickstart shows how to get the openflange command.

Command
printf '%s\n' '"a"' '"b"' '"c"' | openflange run std:limit --param count=2
Standard output (out)
"a"
"b"

Executed with openflange 0.0.1 (go1.27.1 linux/amd64), built from commit 11cf8cc of the reference implementation; the output shown is what it printed, and it matches the test.

Notes from the manifest #

The pipe's manifest, OPENFLANGE.md, carries these notes.

Part of the OpenFlange standard library (std, version 0.1).

Passes the first count items unchanged (they are never decoded) and then completes. The runner tells the upstream producer that nobody reads the stream any more, so an unbounded source ends too — like head in a Unix pipeline. count: 0 emits nothing.

Reference #

Maturity
Experimental
Processing scope
record
Manifest version
0.1.0