Updates
This commit is contained in:
parent
af6b44ffbe
commit
ea8a2eab6b
13
dist/types/index.d.ts
vendored
13
dist/types/index.d.ts
vendored
@ -643,7 +643,6 @@ export type ServerQueryParam<T extends {
|
||||
/**
|
||||
* Raw SQL to use as select
|
||||
*/
|
||||
select_sql?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
@ -808,7 +807,17 @@ export type ServerQueryParamsJoin<Table extends string = string, Field extends o
|
||||
/**
|
||||
* Raw SQL to use as join select
|
||||
*/
|
||||
select_sql?: string;
|
||||
/**
|
||||
* Concatenate multiple matches from another table
|
||||
*/
|
||||
group_concat?: {
|
||||
field: string;
|
||||
alias: string;
|
||||
/**
|
||||
* Separator. Default `,`
|
||||
*/
|
||||
separator?: string;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Defines how a root-table field maps to a join-table field in an `ON` clause.
|
||||
|
||||
5
dist/utils/sql-generator.js
vendored
5
dist/utils/sql-generator.js
vendored
@ -215,8 +215,9 @@ export default function sqlGenerator({ tableName, genObject, dbFullName, count }
|
||||
if (existingJoinTableNames.includes(joinTableName))
|
||||
return null;
|
||||
existingJoinTableNames.push(joinTableName);
|
||||
if (joinObj.select_sql) {
|
||||
return joinObj.select_sql;
|
||||
if (joinObj.group_concat) {
|
||||
let group_concat = `GROUP_CONCAT(${joinTableName}.${joinObj.group_concat.field}, ${joinObj.group_concat.separator || ","}) AS ${joinObj.group_concat.alias}`;
|
||||
return group_concat;
|
||||
}
|
||||
else if (joinObj.selectFields) {
|
||||
return joinObj.selectFields
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/bun-sqlite",
|
||||
"version": "1.0.37",
|
||||
"version": "1.0.38",
|
||||
"description": "SQLite manager for Bun",
|
||||
"author": "Benjamin Toby",
|
||||
"main": "dist/index.js",
|
||||
|
||||
@ -715,7 +715,7 @@ export type ServerQueryParam<
|
||||
/**
|
||||
* Raw SQL to use as select
|
||||
*/
|
||||
select_sql?: string;
|
||||
// select_sql?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
@ -902,7 +902,18 @@ export type ServerQueryParamsJoin<
|
||||
/**
|
||||
* Raw SQL to use as join select
|
||||
*/
|
||||
select_sql?: string;
|
||||
// select_sql?: string;
|
||||
/**
|
||||
* Concatenate multiple matches from another table
|
||||
*/
|
||||
group_concat?: {
|
||||
field: string;
|
||||
alias: string;
|
||||
/**
|
||||
* Separator. Default `,`
|
||||
*/
|
||||
separator?: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -312,8 +312,9 @@ export default function sqlGenerator<
|
||||
return null;
|
||||
existingJoinTableNames.push(joinTableName);
|
||||
|
||||
if (joinObj.select_sql) {
|
||||
return joinObj.select_sql;
|
||||
if (joinObj.group_concat) {
|
||||
let group_concat = `GROUP_CONCAT(${joinTableName}.${joinObj.group_concat.field}, ${joinObj.group_concat.separator || ","}) AS ${joinObj.group_concat.alias}`;
|
||||
return group_concat;
|
||||
} else if (joinObj.selectFields) {
|
||||
return joinObj.selectFields
|
||||
.map((selectField) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user