transform

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExplodeArray

type ExplodeArray struct{}

ExplodeArray is a transformer that turns an array into a stream of values. It copies other types unchanged.

E.g.
 [1, 2, 3]        -> 1 2 3
 {"x": 2, "y": 5} -> {"x": 2, "y": 5}

func (ExplodeArray) TransformValue

func (f ExplodeArray) TransformValue(value iterator.Value, out token.WriteStream)

TransformValue implements the ExplodeArray transform

type JoinStream

type JoinStream struct{}

JoinStream is the reverse of ExplodeArray. It turns a stream of values into a JSON array

E.g.

1 2 3          -> [1, 2, 3]
[1, 2, 3]      -> [[1, 2, 3]]
<empty stream> -> []

func (JoinStream) Transform

func (f JoinStream) Transform(in <-chan token.Token, out token.WriteStream)

Transform implements the JoinStream transform

type MaxDepthFilter

type MaxDepthFilter struct {
	MaxDepth int
}

MaxDepthFilter is a Transformer that truncates the stream to a given depth. Collections which are more deeply nested than MaxDepth are elided (their contents is replaced with "..." in the examples below).

E.g.

[1, 2, {"x": [3, 4], "y": 2}]

At MaxDepth=0:

[...]

At MaxDepth=1

[1, 2, {...}]

At MaxDepth=2

[1, 2, {"x": [...], "y": 2}]

func (*MaxDepthFilter) Transform

func (f *MaxDepthFilter) Transform(in <-chan token.Token, out token.WriteStream)

Transform implements the MaxDepthFilter tansform.

type TraceStream

type TraceStream struct{}

TraceStream logs all the stream items and doesn't send any items on. It's useful for debugging streams

func (TraceStream) Transform

func (t TraceStream) Transform(in <-chan token.Token, out token.WriteStream)

Transform implements the TraceStream transform

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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