Updates
This commit is contained in:
parent
7dd8111b5b
commit
c6964df00b
@ -69,13 +69,22 @@ function sqlGenerator({ tableName, genObject }) {
|
|||||||
typeof mtch.source == "object" ? mtch.source.tableName : tableName
|
typeof mtch.source == "object" ? mtch.source.tableName : tableName
|
||||||
}.${
|
}.${
|
||||||
typeof mtch.source == "object" ? mtch.source.fieldName : mtch.source
|
typeof mtch.source == "object" ? mtch.source.fieldName : mtch.source
|
||||||
}=${
|
}=${(() => {
|
||||||
typeof mtch.target == "object"
|
if (mtch.targetLiteral) {
|
||||||
? mtch.target.tableName
|
sqlSearhValues.push(mtch.targetLiteral);
|
||||||
: join.tableName
|
return "?";
|
||||||
}.${
|
}
|
||||||
typeof mtch.target == "object" ? mtch.target.fieldName : mtch.target
|
|
||||||
}`;
|
return `${
|
||||||
|
typeof mtch.target == "object"
|
||||||
|
? mtch.target.tableName
|
||||||
|
: join.tableName
|
||||||
|
}.${
|
||||||
|
typeof mtch.target == "object"
|
||||||
|
? mtch.target.fieldName
|
||||||
|
: mtch.target
|
||||||
|
}`;
|
||||||
|
})()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let queryString = (() => {
|
let queryString = (() => {
|
||||||
|
7
package-shared/types/index.d.ts
vendored
7
package-shared/types/index.d.ts
vendored
@ -1168,6 +1168,7 @@ export type FetchDataParams = {
|
|||||||
method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
||||||
body?: object | string;
|
body?: object | string;
|
||||||
query?: AuthFetchQuery;
|
query?: AuthFetchQuery;
|
||||||
|
tableName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AuthFetchQuery = ServerQueryParam & {
|
export type AuthFetchQuery = ServerQueryParam & {
|
||||||
@ -1196,9 +1197,11 @@ export type ServerQueryParamsJoinMatchObject<
|
|||||||
Field extends object = { [key: string]: any }
|
Field extends object = { [key: string]: any }
|
||||||
> = {
|
> = {
|
||||||
/** Field name from the **Root Table** */
|
/** Field name from the **Root Table** */
|
||||||
source: string | ServerQueryParamsJoinMatchSourceTargetObject;
|
source?: string | ServerQueryParamsJoinMatchSourceTargetObject;
|
||||||
/** Field name from the **Join Table** */
|
/** Field name from the **Join Table** */
|
||||||
target: keyof Field | ServerQueryParamsJoinMatchSourceTargetObject;
|
target?: keyof Field | ServerQueryParamsJoinMatchSourceTargetObject;
|
||||||
|
/** A literal value: No source and target Needed! */
|
||||||
|
targetLiteral?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ServerQueryParamsJoinMatchSourceTargetObject = {
|
export type ServerQueryParamsJoinMatchSourceTargetObject = {
|
||||||
|
Loading…
Reference in New Issue
Block a user