Documentation
¶
Overview ¶
Package keyorder remembers the key order of objects decoded from input, so encoders can write objects that a query passes through unchanged in their original order.
Order is attached to a specific map value, not to its contents. gojq builds a new map for any object a query creates or modifies, and such maps have no recorded order, so encoders fall back to sorted keys for them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
func Enabled() bool
Enabled reports whether encoders should write keys in recorded order.
func Keys ¶
Keys returns the keys of m in recorded order, followed by any keys that have no recorded position, sorted. Without a recorded order all keys are sorted.
func Record ¶
Record sets the key order of m. keys may contain duplicates or keys that are not in m; Keys ignores both.
func RecordRows ¶
RecordRows sets keys as the order of every object in rows, for formats where one header row orders all records.
func StopRecording ¶
func StopRecording()
StopRecording keeps the recorded orders but ignores later Record calls, so decoding done after the input is read, such as re-parsing output for raw formatting, does not grow the registry.
Types ¶
This section is empty.