Updates
This commit is contained in:
parent
9dbaca5ebe
commit
e4590e74d9
@ -35,8 +35,12 @@ function sqlGenerator({ tableName, genObject }) {
|
|||||||
typeof queryObj.value == "number"
|
typeof queryObj.value == "number"
|
||||||
) {
|
) {
|
||||||
const valueParsed = String(queryObj.value);
|
const valueParsed = String(queryObj.value);
|
||||||
|
|
||||||
if (queryObj.equality == "LIKE") {
|
if (queryObj.equality == "LIKE") {
|
||||||
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
|
||||||
|
} else if (queryObj.equality == "NOT EQUAL") {
|
||||||
|
str = `${finalFieldName} != ?`;
|
||||||
|
sqlSearhValues.push(valueParsed);
|
||||||
} else {
|
} else {
|
||||||
sqlSearhValues.push(valueParsed);
|
sqlSearhValues.push(valueParsed);
|
||||||
}
|
}
|
||||||
@ -49,6 +53,9 @@ function sqlGenerator({ tableName, genObject }) {
|
|||||||
strArray.push(
|
strArray.push(
|
||||||
`LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`
|
`LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`
|
||||||
);
|
);
|
||||||
|
} else if (queryObj.equality == "NOT EQUAL") {
|
||||||
|
strArray.push(`${finalFieldName} != ?`);
|
||||||
|
sqlSearhValues.push(valueParsed);
|
||||||
} else {
|
} else {
|
||||||
strArray.push(`${finalFieldName} = ?`);
|
strArray.push(`${finalFieldName} = ?`);
|
||||||
sqlSearhValues.push(valueParsed);
|
sqlSearhValues.push(valueParsed);
|
||||||
|
4
package-shared/types/index.d.ts
vendored
4
package-shared/types/index.d.ts
vendored
@ -917,7 +917,7 @@ export type ServerQueryParam = {
|
|||||||
strategy: "ASC" | "DESC";
|
strategy: "ASC" | "DESC";
|
||||||
};
|
};
|
||||||
searchOperator?: "AND" | "OR";
|
searchOperator?: "AND" | "OR";
|
||||||
searchEquality?: "EQUAL" | "LIKE";
|
searchEquality?: "EQUAL" | "LIKE" | "NOT EQUAL";
|
||||||
addUserId?: {
|
addUserId?: {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
};
|
};
|
||||||
@ -931,7 +931,7 @@ export type ServerQueryQueryObject<T extends object = {
|
|||||||
[key in keyof T]: {
|
[key in keyof T]: {
|
||||||
value: string | string[];
|
value: string | string[];
|
||||||
operator?: "AND" | "OR";
|
operator?: "AND" | "OR";
|
||||||
equality?: "EQUAL" | "LIKE";
|
equality?: "EQUAL" | "LIKE" | "NOT EQUAL";
|
||||||
tableName?: string;
|
tableName?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1095,7 +1095,7 @@ export type ServerQueryParam = {
|
|||||||
strategy: "ASC" | "DESC";
|
strategy: "ASC" | "DESC";
|
||||||
};
|
};
|
||||||
searchOperator?: "AND" | "OR";
|
searchOperator?: "AND" | "OR";
|
||||||
searchEquality?: "EQUAL" | "LIKE";
|
searchEquality?: "EQUAL" | "LIKE" | "NOT EQUAL";
|
||||||
addUserId?: {
|
addUserId?: {
|
||||||
fieldName: string;
|
fieldName: string;
|
||||||
};
|
};
|
||||||
@ -1109,7 +1109,7 @@ export type ServerQueryQueryObject<T extends object = { [key: string]: any }> =
|
|||||||
[key in keyof T]: {
|
[key in keyof T]: {
|
||||||
value: string | string[];
|
value: string | string[];
|
||||||
operator?: "AND" | "OR";
|
operator?: "AND" | "OR";
|
||||||
equality?: "EQUAL" | "LIKE";
|
equality?: "EQUAL" | "LIKE" | "NOT EQUAL";
|
||||||
tableName?: string;
|
tableName?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "3.1.9",
|
"version": "3.2.0",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user