gizmodel/sql/parsejson
The SQL parser: the SQL/JSON and SQL/XML forms.
import * as Parsejson from "gizmodel/sql/parsejson";Methods
Parser.jsonFormat
function Parser.jsonFormat(self: mut Parser): boolFORMAT JSON [ENCODING name] after a SQL/JSON value or RETURNING type: JSON text is read as it is, so it is skipped.
Effects: fail, alloc.
Parser.opclassOptions
function Parser.opclassOptions(self: mut Parser, opclass: string): voidAn operator class's parameters, (name = value, ...). The text search GiST classes take siglen in 1..2024; the values are checked and not kept, as an index here keeps no signature.
Effects: fail, alloc.
Parser.xmlForm
function Parser.xmlForm(self: mut Parser, name: string): Option<Expr>The SQL/XML forms whose arguments are no plain list, after "xmlname(": XMLELEMENT, XMLFOREST, XMLPI, XMLROOT, XMLPARSE, XMLSERIALIZE, XMLEXISTS and XMLAGG. Names map to XML names (xml.giz xmlName). none: a plain call.
Effects: fail, read, alloc.
Parser.xmlTable
function Parser.xmlTable(self: mut Parser): FromXMLTABLE([XMLNAMESPACES(uri AS prefix, ...),] row_path PASSING [BY REF|VALUE] doc [BY REF|VALUE] COLUMNS name {FOR ORDINALITY | type [PATH p] [DEFAULT d] [NOT NULL | NULL]}, ...): the function \u0001xmltable with arguments (row path, doc, namespaces as an array literal, then per column name, type, path, default, flags: 1 ordinality, 2 not null). Parser.xmlQuery makes the query.
Effects: fail, read, alloc.
Parser.xmlQuery
function Parser.xmlQuery(self: mut Parser, f: From): FromThe XMLTABLE item f (Parser.xmlTable) as the lateral query it stands for: the cells of every row are made once, in
a one-row query (\u0001xml_pack), and a series over the rows picks them (\u0001xml_pick), cast to the column types.
The column list f.columns renames the columns.
Effects: fail, alloc.
Parser.jsonValue
function Parser.jsonValue(self: mut Parser, query: bool): Option<Expr>JSON_VALUE and JSON_QUERY (query) with their clauses; none when no clause follows the path, which leaves the
two-argument json_value and json_query of the other dialects to the generic call.
Effects: fail, read, alloc.
Parser.jsonExists
function Parser.jsonExists(self: mut Parser): ExprJSON_EXISTS(doc, path [PASSING ...] [TRUE | FALSE | ERROR ON ERROR]).
Effects: fail, read, alloc.
Parser.jsonSerialize
function Parser.jsonSerialize(self: mut Parser): ExprJSON_SERIALIZE(doc [RETURNING type] [PRETTY] [ASCII] [TRUNCATE] [ERROR | NULL ON ERROR]).
Effects: fail, read, alloc.
Parser.jsonTransform
function Parser.jsonTransform(self: mut Parser): ExprJSON_TRANSFORM(doc, SET | INSERT | REPLACE | APPEND | PREPEND path = value [clauses], REMOVE path, RENAME path = name, KEEP path, ... [RETURNING type]).
Effects: fail, read, alloc.
Parser.jsonTable
function Parser.jsonTable(self: mut Parser): FromJSON_TABLE(doc, path [ON ERROR] COLUMNS (...)) as a lateral query over the rows of fnJsonRows: the top level and, left-joined under it, a source for each level of NESTED PATH columns.
Effects: fail, read, alloc.