pkg/types/README.md
This package contains types.Context and related stream types. The Mlrval and Mlrmap types used for record values and expression/variable values in the Miller put/filter DSL are implemented in the pkg/mlrval package.
The Mlrval structure (in package mlrval) includes string, int, float, boolean, array-of-mlrval, map-string-to-mlrval, void, absent, and error types as well as type-conversion logic for various operators.
absent type is like Javascript's undefined -- it's for times when there is no such key, as in a DSL expression $out = $foo when the input record is $x=3,y=4 -- there is no $foo so $foo has absent type. Nothing is written to the $out field in this case. See also here for more information.void type is like Javascript's null -- it's for times when there is a key with no value, as in $out = $x when the input record is $x=,$y=4. This is an overlap with string type, since a void value looks like an empty string. I've gone back and forth on this (including when I was writing the C implementation) -- whether to retain void as a distinct type from empty-string, or not. I ended up keeping it as it made the Mlrval logic easier to understand.error type is for things like doing type-uncoerced addition of strings. Data-dependent errors are intended to result in (error)-valued output, rather than crashing Miller. See also here for more information.BigInt).$a * $b in Miller will auto-overflow to float. Using $a .* $b will stick with 64-bit integers (if $a and $b are already 64-bit integers).|, &, and ^ map ints to ints.+, *, etc. map ints to ints unless they overflow in which case float is produced..+, .*, etc. map ints to ints even if they overflow.Mlrval class implements.Mlrmap is the sequence of key-value pairs which represents a Miller record (implemented in package mlrval). The key-lookup mechanism is optimized for Miller read/write usage patterns -- please see mlrmap.go for more details.
It's also an ordered map structure, with string keys and Mlrval values. This is used within Mlrval itself.
types.Context supports AWK-like variables such as FILENAME, NF, NR, and so on.
Mlrval and `Mlrmap. This is unsurprising since JSON is a mutually recursive data structure -- arrays can contain maps and vice versa.--ojson), the dump and print DSL routines, and the json_stringify DSL function.
--jvstack and --no-jvstack, the former (multiline) being the default.dump and print DSL routines produce multi-line output without a way for the user to choose single-line output.json_stringify DSL function lets the user specify multi-line or single-line, with the former being the default,