sqljson-query
Advanced tools
Comparing version 1.9.6 to 1.9.7
@@ -28,5 +28,5 @@ "use strict"; | ||
getAggregatedColumnValuesExpression(valueExpression, orderBy) { | ||
return (`coalesce(jsonb_agg(${valueExpression}` + | ||
return (`coalesce(json_arrayagg(${valueExpression}` + | ||
(orderBy != null ? ' order by ' + orderBy : '') + | ||
'))'); | ||
`), '[]')`); | ||
} | ||
@@ -33,0 +33,0 @@ quoteObjectNameIfNeeded(name) { |
@@ -8,3 +8,3 @@ import { Nullable } from '../../util/nullable'; | ||
readonly lowercaseNameRegex: RegExp; | ||
constructor(indentSpaces: number); | ||
constructor(indentSpaces: number, jsonVariant?: 'json' | 'jsonb'); | ||
getRowObjectExpression(selectEntries: SelectEntry[], selectEntryValueSqlFn: (selectEntry: SelectEntry) => string): string; | ||
@@ -11,0 +11,0 @@ getAggregatedRowObjectsExpression(selectEntries: SelectEntry[], selectEntryValueSqlFn: (selectEntry: SelectEntry) => string, orderBy: Nullable<string>): string; |
@@ -7,3 +7,3 @@ "use strict"; | ||
class PostgresDialect { | ||
constructor(indentSpaces) { | ||
constructor(indentSpaces, jsonVariant = 'jsonb') { | ||
this.indentSpaces = indentSpaces; | ||
@@ -30,3 +30,3 @@ this.quotedStringRegex = /^".*"$/; | ||
(orderBy != null ? ' order by ' + orderBy : '') + | ||
'))'); | ||
`),'[]'::jsonb)`); | ||
} | ||
@@ -33,0 +33,0 @@ quoteObjectNameIfNeeded(name) { |
@@ -42,5 +42,2 @@ "use strict"; | ||
const sqlb = new sql_specs_1.SqlParts(); | ||
const relId = (0, query_specs_1.identifyTable)(tjs.table, this.defaultSchema, this.dbmd, specLoc); | ||
const alias = tjs.alias || sqlb.createTableAlias(relId.name); | ||
sqlb.addFromEntry({ entryType: 'table', table: { ...relId }, alias }); | ||
// If we have a condition from a related table, register other table's alias to avoid shadowing it. | ||
@@ -51,2 +48,5 @@ if (parentChildCond) | ||
: parentChildCond.childAlias); | ||
const relId = (0, query_specs_1.identifyTable)(tjs.table, this.defaultSchema, this.dbmd, specLoc); | ||
const alias = tjs.alias || sqlb.createTableAlias(relId.name); | ||
sqlb.addFromEntry({ entryType: 'table', table: { ...relId }, alias }); | ||
if (exportPkFieldsHidden) | ||
@@ -53,0 +53,0 @@ sqlb.addSelectEntries(this.hiddenPrimaryKeySelectEntries(relId, alias)); |
{ | ||
"name": "sqljson-query", | ||
"version": "1.9.6", | ||
"version": "1.9.7", | ||
"description": "Command line tool to generate SQL/JSON SQL queries and result types for Typescript or Java.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -58,5 +58,5 @@ import {Nullable} from '../../util/nullable'; | ||
return ( | ||
`coalesce(jsonb_agg(${valueExpression}` + | ||
`coalesce(json_arrayagg(${valueExpression}` + | ||
(orderBy != null ? ' order by ' + orderBy : '') + | ||
'))' | ||
`), '[]')` | ||
); | ||
@@ -63,0 +63,0 @@ } |
@@ -11,3 +11,3 @@ import {Nullable} from '../../util/nullable'; | ||
constructor(readonly indentSpaces: number) {} | ||
constructor(readonly indentSpaces: number, jsonVariant: 'json' | 'jsonb' = 'jsonb') {} | ||
@@ -59,3 +59,3 @@ getRowObjectExpression | ||
(orderBy != null ? ' order by ' + orderBy : '') + | ||
'))' | ||
`),'[]'::jsonb)` | ||
); | ||
@@ -62,0 +62,0 @@ } |
@@ -94,8 +94,2 @@ import {caseNormalizeName, exactUnquotedName, makeMap, Nullable, relIdDescn} from '../util/mod'; | ||
const relId = identifyTable(tjs.table, this.defaultSchema, this.dbmd, specLoc); | ||
const alias = tjs.alias || sqlb.createTableAlias(relId.name); | ||
sqlb.addFromEntry({ entryType: 'table', table: { ...relId }, alias }); | ||
// If we have a condition from a related table, register other table's alias to avoid shadowing it. | ||
@@ -108,2 +102,8 @@ if (parentChildCond) | ||
const relId = identifyTable(tjs.table, this.defaultSchema, this.dbmd, specLoc); | ||
const alias = tjs.alias || sqlb.createTableAlias(relId.name); | ||
sqlb.addFromEntry({ entryType: 'table', table: { ...relId }, alias }); | ||
if (exportPkFieldsHidden) | ||
@@ -110,0 +110,0 @@ sqlb.addSelectEntries(this.hiddenPrimaryKeySelectEntries(relId, alias)); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
632431