@uql/sqlite
Advanced tools
Comparing version 0.4.33 to 0.4.34
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.4.33", | ||
"version": "0.4.34", | ||
"main": "index.js", | ||
@@ -25,3 +25,3 @@ "types": "index.d.ts", | ||
"@types/sqlite3": "^3.1.7", | ||
"@uql/core": "^0.4.33", | ||
"@uql/core": "^0.4.34", | ||
"copyfiles": "^2.4.1", | ||
@@ -28,0 +28,0 @@ "rimraf": "^3.0.2", |
@@ -18,7 +18,7 @@ [](https://travis-ci.org/impensables/uql?branch=master) | ||
- declarative and programmatic `transactions` | ||
- soft-delete | ||
- virtual fields | ||
- `soft-delete` | ||
- `virtual fields` | ||
- entity `repositories` | ||
- different kind of `relations` between the entities | ||
- supports `inheritance` patterns between the entities | ||
- different kind of `relations` between entities | ||
- supports `inheritance` patterns between entities | ||
- connection pooling | ||
@@ -154,2 +154,3 @@ - supports Postgres, MySQL, MariaDB, SQLite, MongoDB (beta) | ||
} | ||
interface ICompany extends IEntity { | ||
@@ -348,5 +349,14 @@ name?: string; | ||
@Field({ | ||
virtual: raw(({ escapedPrefix: ep, dialect }) => { | ||
const i = dialect.escapeId.bind(dialect); | ||
return `(SELECT COUNT(*) FROM ${i('ItemTag')} ${i('it')} WHERE ${i('it')}.${i('itemId')} = ${ep}${i('id')})`; | ||
value: raw(({ escapedPrefix, dialect }) => { | ||
const query = dialect.find( | ||
ItemTag, | ||
{ | ||
$project: [raw('COUNT(*)')], | ||
$filter: { | ||
itemId: raw(`${escapedPrefix}${dialect.escapeId('id')}`), | ||
}, | ||
}, | ||
{ usePrefix: true } | ||
); | ||
return `(${query})`; | ||
}), | ||
@@ -353,0 +363,0 @@ }) |
27552
572