@travetto/model-sqlite 8.0.0-alpha.28 → 8.0.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/dialect.ts +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-sqlite",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SQLite backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"directory": "module/model-sqlite"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
31
|
-
"@travetto/context": "^8.0.0-alpha.
|
|
32
|
-
"@travetto/model": "^8.0.0-alpha.
|
|
33
|
-
"@travetto/model-query": "^8.0.0-alpha.
|
|
34
|
-
"@travetto/model-sql": "^8.0.0-alpha.
|
|
30
|
+
"@travetto/config": "^8.0.0-alpha.24",
|
|
31
|
+
"@travetto/context": "^8.0.0-alpha.22",
|
|
32
|
+
"@travetto/model": "^8.0.0-alpha.25",
|
|
33
|
+
"@travetto/model-query": "^8.0.0-alpha.27",
|
|
34
|
+
"@travetto/model-sql": "^8.0.0-alpha.29"
|
|
35
35
|
},
|
|
36
36
|
"travetto": {
|
|
37
37
|
"displayName": "SQLite Model Service"
|
package/src/dialect.ts
CHANGED
|
@@ -163,6 +163,17 @@ NOT EXISTS (
|
|
|
163
163
|
return { sql: `(${jsonArrayExpression} IS NOT NULL AND json_array_length(${jsonArrayExpression}) > 0)` };
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
compileArrayRegex(context: ResolvedPathContext, identifier: string, value: RegExp | string): { sql: string; formatted: unknown } {
|
|
167
|
+
const regex = value instanceof RegExp ? value : new RegExp(String(value));
|
|
168
|
+
const caseInsensitive = regex.flags.includes('i');
|
|
169
|
+
const regexOp = this.getRegexOperator(caseInsensitive);
|
|
170
|
+
const regexSource = this.formatRegex(regex.source, caseInsensitive);
|
|
171
|
+
return {
|
|
172
|
+
sql: this.#buildArrayElementExists(context, leafExpression => `${leafExpression} ${regexOp} ${identifier}`),
|
|
173
|
+
formatted: regexSource
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
166
177
|
getRegexOperator(caseInsensitive: boolean): string {
|
|
167
178
|
return 'REGEXP';
|
|
168
179
|
}
|