Skip to main content

@terascope/data-mate / teal-frame/export-json

teal-frame/export-json

Interfaces​

InterfaceDescription
JsonExportOptionsHow an export renders fields and nulls: DataFrame's SerializeOptions, with the same meaning, plus removeNullFields as a shorthand for two common presets. See resolveRules.

Functions​

buildJsonExpression()​

buildJsonExpression(config, options?): string

Defined in: data-mate/src/teal-frame/export-json.ts:475

A SQL expression producing one JSON string per row, byte-identical to DataFrame.toJSON with the same options, or NULL for a row that skipEmptyObjects drops.

Two things are left to the caller: removing duplicate rows under skipDuplicateObjects, which compares whole rendered rows in order and is done on the stream (TealFrame.ndjson), and filtering rows, which uses buildJsonRowFilter.

Parameters​

ParameterType
configDataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>>
optionsJsonExportOptions

Returns​

string


buildJsonListElements()​

buildJsonListElements(config, column, options?): object

Defined in: data-mate/src/teal-frame/export-json.ts:440

SQL rendering one LIST column's elements as JSON text (see TealFrame.listValues), and whether the elements are objects, which decides whether skipNilObjectValues applies.

Parameters​

ParameterType
configDataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>>
columnstring
optionsJsonExportOptions

Returns​

object

isObject​

isObject: boolean

sql​

sql: string


buildJsonRowFilter()​

buildJsonRowFilter(config, options?): string | undefined

Defined in: data-mate/src/teal-frame/export-json.ts:459

The predicate for the rows an export writes, or undefined when it writes all of them. It is separate from buildJsonExpression so the filter never evaluates the rendered row.

Parameters​

ParameterType
configDataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>>
optionsJsonExportOptions

Returns​

string | undefined


resolveRules()​

resolveRules(options?): Rules

Defined in: data-mate/src/teal-frame/export-json.ts:170

Resolves the rules an export follows.

If any SerializeOptions flag is given, the flags mean exactly what they mean to DataFrame.toJSON, and an unset flag is false. removeNullFields selects a preset that explicit flags override. With neither, the default is the removeNullFields: true preset.

Parameters​

ParameterType
optionsJsonExportOptions

Returns​

Rules