Skip to main content

stringifyArrayLiteral

stringifyArrayLiteral(value, options?, encode?)

ParameterTypeDescription
valueany[]The (possibly nested/multi-dimensional) array to stringify
optionsDataMappingOptionsData mapping options passed through to encode
encodeEncodeTextFunctionFunction used to encode each leaf element before quoting

Returns: string

Produces PostgreSQL's curly-brace array literal syntax (e.g. {"1","2",NULL}), inferring dimensions from the input array, quoting each element and escaping embedded backslashes/double quotes. Used to encode array values as text for the wire protocol.