Updates
This commit is contained in:
parent
e4590e74d9
commit
0a77a869f7
@ -131,14 +131,16 @@ function sqlGenerator({ tableName, genObject }) {
|
||||
|
||||
if (joinObj.selectFields) {
|
||||
return joinObj.selectFields
|
||||
.map((slFld) => {
|
||||
if (typeof slFld == "string") {
|
||||
return `${joinTableName}.${slFld}`;
|
||||
} else if (typeof slFld == "object") {
|
||||
let aliasSlctFld = `${joinTableName}.${slFld.field}`;
|
||||
if (slFld.alias)
|
||||
aliasSlctFld += ` as ${slFld.alias}`;
|
||||
return aliasSlctFld;
|
||||
.map((selectField) => {
|
||||
if (typeof selectField == "string") {
|
||||
return `${joinTableName}.${selectField}`;
|
||||
} else if (typeof selectField == "object") {
|
||||
let aliasSelectField = selectField.count
|
||||
? `COUNT(${joinTableName}.${selectField.field})`
|
||||
: `${joinTableName}.${selectField.field}`;
|
||||
if (selectField.alias)
|
||||
aliasSelectField += ` AS ${selectField.alias}`;
|
||||
return aliasSelectField;
|
||||
}
|
||||
})
|
||||
.join(",");
|
||||
|
1
package-shared/types/index.d.ts
vendored
1
package-shared/types/index.d.ts
vendored
@ -955,6 +955,7 @@ export type ServerQueryParamsJoin<Table extends string = string, Field extends o
|
||||
selectFields?: (keyof Field | {
|
||||
field: keyof Field;
|
||||
alias?: string;
|
||||
count?: boolean;
|
||||
})[];
|
||||
};
|
||||
export type ServerQueryParamsJoinMatchObject<Field extends object = {
|
||||
|
@ -1141,6 +1141,7 @@ export type ServerQueryParamsJoin<
|
||||
| {
|
||||
field: keyof Field;
|
||||
alias?: string;
|
||||
count?: boolean;
|
||||
}
|
||||
)[];
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.1",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user