This commit is contained in:
Benjamin Toby 2025-08-26 11:37:28 +01:00
parent 82bea3efd0
commit 2336b71703
5 changed files with 12 additions and 4 deletions

View File

@ -15,7 +15,7 @@ function generateTypeDefinition({ paradigm, table, query, typeDefName, allValues
: `DSQL_${query.single}_${query.single_table}`.toUpperCase(); : `DSQL_${query.single}_${query.single_table}`.toUpperCase();
const fields = table.fields; const fields = table.fields;
function typeMap(schemaType) { function typeMap(schemaType) {
var _a, _b; var _a, _b, _c;
if (schemaType.options && schemaType.options.length > 0) { if (schemaType.options && schemaType.options.length > 0) {
return schemaType.options return schemaType.options
.map((opt) => { .map((opt) => {
@ -33,6 +33,9 @@ function generateTypeDefinition({ paradigm, table, query, typeDefName, allValues
if ((_b = schemaType.dataType) === null || _b === void 0 ? void 0 : _b.match(/text|varchar|timestamp/i)) { if ((_b = schemaType.dataType) === null || _b === void 0 ? void 0 : _b.match(/text|varchar|timestamp/i)) {
return "string"; return "string";
} }
if ((_c = schemaType.dataType) === null || _c === void 0 ? void 0 : _c.match(/boolean/i)) {
return "boolean";
}
return "string"; return "string";
} }
const typesArrayTypeScript = []; const typesArrayTypeScript = [];

View File

@ -35,7 +35,7 @@ function sqlGenOperatorGen({ fieldName, value, equality, }) {
} }
else if (equality == "REGEXP") { else if (equality == "REGEXP") {
return { return {
str: `LOWER(${fieldName}) REGEXP LOWER(?')`, str: `LOWER(${fieldName}) REGEXP LOWER(?)`,
param: value, param: value,
}; };
} }

View File

@ -45,10 +45,15 @@ export default function generateTypeDefinition({
if (schemaType.dataType?.match(/int/i)) { if (schemaType.dataType?.match(/int/i)) {
return "number"; return "number";
} }
if (schemaType.dataType?.match(/text|varchar|timestamp/i)) { if (schemaType.dataType?.match(/text|varchar|timestamp/i)) {
return "string"; return "string";
} }
if (schemaType.dataType?.match(/boolean/i)) {
return "boolean";
}
return "string"; return "string";
} }

View File

@ -42,7 +42,7 @@ export default function sqlGenOperatorGen({
}; };
} else if (equality == "REGEXP") { } else if (equality == "REGEXP") {
return { return {
str: `LOWER(${fieldName}) REGEXP LOWER(?')`, str: `LOWER(${fieldName}) REGEXP LOWER(?)`,
param: value, param: value,
}; };
} else if (equality == "FULLTEXT") { } else if (equality == "FULLTEXT") {

View File

@ -1,6 +1,6 @@
{ {
"name": "@moduletrace/datasquirel", "name": "@moduletrace/datasquirel",
"version": "5.2.2", "version": "5.2.3",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {