@balena/abstract-sql-compiler
Advanced tools
Comparing version
@@ -151,3 +151,8 @@ export declare const enum Engines { | ||
export type FnCallNode = ['FnCall', string, ...AnyTypeNodes[]]; | ||
export type UnknownTypeNodes = SelectQueryNode | UnionQueryNode | NullNode | FieldNode | ReferencedFieldNode | BindNode | CastNode | CaseNode | CoalesceNode | AnyNode | FnCallNode; | ||
export type UnknownTypeNodes = SelectQueryNode | JSONPopulateRecordNode | UnionQueryNode | NullNode | FieldNode | ReferencedFieldNode | BindNode | CastNode | CaseNode | CoalesceNode | AnyNode | FnCallNode; | ||
/** | ||
* This converts a row that looks like a specific table row based upon column names to the actual row type | ||
* of that table using the column names and avoiding issues due to the positional order of the columns. | ||
* Note: this only takes effect on postgres | ||
*/ | ||
export type ConvertRowNode = ['ConvertRow', SelectQueryNode, TableNode]; | ||
@@ -154,0 +159,0 @@ export type JSONPopulateRecordNode = [ |
@@ -86,3 +86,3 @@ import { isFieldNode, isFieldTypeNode, isReferencedFieldNode, isTableNode, } from './abstract-sql-compiler.js'; | ||
case 'FnCall': | ||
return typeRules[type](rest); | ||
case 'JSONPopulateRecord': | ||
case 'ConvertRow': | ||
@@ -235,2 +235,3 @@ case 'SelectQuery': | ||
case 'JSONPopulateRecord': | ||
case 'ConvertRow': | ||
return typeRules[type](rest); | ||
@@ -1188,15 +1189,8 @@ default: | ||
: [ | ||
'SelectQuery', | ||
['Select', [['Field', '*']]], | ||
'JSONPopulateRecord', | ||
['Cast', ['Null'], castTable], | ||
[ | ||
'From', | ||
[ | ||
'JSONPopulateRecord', | ||
['Cast', ['Null'], castTable], | ||
[ | ||
'SelectQuery', | ||
['Select', [['RowToJSON', ['ReferencedField', 'r', '*']]]], | ||
['From', ['Alias', selectQuery, 'r']], | ||
], | ||
], | ||
'SelectQuery', | ||
['Select', [['RowToJSON', ['ReferencedField', 'r', '*']]]], | ||
['From', ['Alias', selectQuery, 'r']], | ||
], | ||
@@ -1203,0 +1197,0 @@ ])), |
@@ -49,2 +49,3 @@ import $sbvrTypes from '@balena/sbvr-types'; | ||
case 'FnCall': | ||
case 'JSONPopulateRecord': | ||
return typeRules[type](rest, indent); | ||
@@ -513,4 +514,3 @@ case 'SelectQuery': | ||
case 'SelectQuery': | ||
case 'UnionQuery': | ||
case 'JSONPopulateRecord': { | ||
case 'UnionQuery': { | ||
const nestedindent = NestedIndent(indent); | ||
@@ -520,3 +520,4 @@ const query = typeRules[type](rest, nestedindent); | ||
} | ||
case 'Table': { | ||
case 'Table': | ||
case 'JSONPopulateRecord': { | ||
return typeRules[type](rest, indent); | ||
@@ -523,0 +524,0 @@ } |
{ | ||
"name": "@balena/abstract-sql-compiler", | ||
"version": "11.2.0-build-convert-row-ca62572414f258dcaaa0c2093f0d729d7a24d928-1", | ||
"version": "11.2.0-build-convert-row-e1988d6cbc6cb5a759b14e31854636bebc5a26a6-1", | ||
"description": "A translator for abstract sql into sql.", | ||
@@ -63,4 +63,4 @@ "type": "module", | ||
"versionist": { | ||
"publishedAt": "2025-08-15T13:10:51.459Z" | ||
"publishedAt": "2025-08-15T14:44:04.252Z" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
296466
0.01%