@uql/core 0.4.88 → 0.4.91
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/README.md +40 -35
- package/package.json +1 -1
- package/dialect/abstractSqlDialect-spec.d.ts +0 -49
- package/dialect/abstractSqlDialect-spec.js +0 -765
- package/dialect/mysqlDialect.spec.d.ts +0 -6
- package/dialect/mysqlDialect.spec.js +0 -33
- package/dialect/postgresDialect.spec.d.ts +0 -1
- package/dialect/postgresDialect.spec.js +0 -139
- package/dialect/sqliteDialect.spec.d.ts +0 -1
- package/dialect/sqliteDialect.spec.js +0 -12
- package/entity/decorator/definition.spec.d.ts +0 -1
- package/entity/decorator/definition.spec.js +0 -725
- package/entity/decorator/relation.spec.d.ts +0 -1
- package/entity/decorator/relation.spec.js +0 -55
- package/options.spec.d.ts +0 -1
- package/options.spec.js +0 -27
- package/querier/abstractQuerier-it.d.ts +0 -41
- package/querier/abstractQuerier-it.js +0 -410
- package/querier/abstractSqlQuerier-it.d.ts +0 -9
- package/querier/abstractSqlQuerier-it.js +0 -19
- package/querier/abstractSqlQuerier-spec.d.ts +0 -53
- package/querier/abstractSqlQuerier-spec.js +0 -607
- package/querier/decorator/injectQuerier.spec.d.ts +0 -1
- package/querier/decorator/injectQuerier.spec.js +0 -108
- package/querier/decorator/transactional.spec.d.ts +0 -1
- package/querier/decorator/transactional.spec.js +0 -239
- package/repository/genericRepository.spec.d.ts +0 -1
- package/repository/genericRepository.spec.js +0 -86
- package/test/entityMock.d.ts +0 -180
- package/test/entityMock.js +0 -451
- package/test/index.d.ts +0 -3
- package/test/index.js +0 -7
- package/test/it.util.d.ts +0 -4
- package/test/it.util.js +0 -60
- package/test/spec.util.d.ts +0 -13
- package/test/spec.util.js +0 -54
- package/util/dialect.util.spec.d.ts +0 -1
- package/util/dialect.util.spec.js +0 -23
- package/util/object.util.spec.d.ts +0 -1
- package/util/object.util.spec.js +0 -26
- package/util/sql.util.spec.d.ts +0 -1
- package/util/sql.util.spec.js +0 -164
- package/util/string.util.spec.d.ts +0 -1
- package/util/string.util.spec.js +0 -26
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Learn more of uql in the website https://uql.io :high_brightness:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Quick Start
|
|
6
6
|
|
|
7
7
|
`uql` is a flexible and efficient `ORM`, with declarative `JSON` syntax and really smart type-safety.
|
|
8
8
|
|
|
9
9
|
The `uql` queries can be safely written in the frontend (browser/mobile) and sent to the backend; or only use `uql` in the backend, or even in a mobile app with an embedded database (like `sqlite`).
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### <a name="features"></a> Features
|
|
12
12
|
|
|
13
13
|
- `JSON` (serializable) syntax for all the [queries](https://uql.io/docs/querying-logical-operators).
|
|
14
14
|
- uses the power of `TypeScript` to get smart type-safety [everywhere](https://uql.io/docs/api-repository).
|
|
@@ -19,51 +19,51 @@ The `uql` queries can be safely written in the frontend (browser/mobile) and sen
|
|
|
19
19
|
- transparent support for [inheritance](https://uql.io/docs/entities-advanced) between entities.
|
|
20
20
|
- supports `Postgres`, `MySQL`, `MariaDB`, `SQLite`, `MongoDB`.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
### <a name="installation"></a> Installation
|
|
23
23
|
|
|
24
24
|
1. Install the core package:
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
```sh
|
|
27
|
+
npm install @uql/core --save
|
|
28
|
+
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
or
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
```sh
|
|
33
|
+
yarn add @uql/core
|
|
34
|
+
```
|
|
35
35
|
|
|
36
36
|
2. Install one of the specific packages according to your database:
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
| Database | Package |
|
|
39
|
+
| ------------ | --------------- |
|
|
40
|
+
| `MySQL` | `@uql/mysql` |
|
|
41
|
+
| `PostgreSQL` | `@uql/postgres` |
|
|
42
|
+
| `MariaDB` | `@uql/maria` |
|
|
43
|
+
| `MongoDB` | `@uql/mongo` |
|
|
44
|
+
| `SQLite` | `@uql/sqlite` |
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
E.g. for `PostgreSQL`
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
```sh
|
|
49
|
+
npm install @uql/postgres --save
|
|
50
|
+
```
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
or with _yarn_
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
```sh
|
|
55
|
+
yarn add @uql/postgres
|
|
56
|
+
```
|
|
57
57
|
|
|
58
58
|
3. Additionally, your `tsconfig.json` may need the following flags:
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
```json
|
|
61
|
+
"target": "es2020",
|
|
62
|
+
"experimentalDecorators": true,
|
|
63
|
+
"emitDecoratorMetadata": true
|
|
64
|
+
```
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
### <a name="configuration"></a> Configuration
|
|
67
67
|
|
|
68
68
|
A default querier-pool can be set in any of the bootstrap files of your app (e.g. in the `server.ts`).
|
|
69
69
|
|
|
@@ -85,7 +85,7 @@ const querierPool = new PgQuerierPool(
|
|
|
85
85
|
setDefaultQuerierPool(querierPool);
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
### <a name="definition-of-entities"></a> Definition of Entities
|
|
89
89
|
|
|
90
90
|
Take any dump class (aka DTO) and annotate it with the decorators from `'@uql/core/entity'`.
|
|
91
91
|
|
|
@@ -151,16 +151,21 @@ export class MeasureUnit {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
### <a name="data-query"></a> Data query
|
|
155
155
|
|
|
156
156
|
```ts
|
|
157
|
-
import { getQuerier
|
|
157
|
+
import { getQuerier } from '@uql/core';
|
|
158
158
|
import { User } from './entity';
|
|
159
159
|
|
|
160
160
|
const querier = await getQuerier();
|
|
161
161
|
|
|
162
|
+
const id = await this.querier.insertOne(User, {
|
|
163
|
+
email: 'lorem@example.com',
|
|
164
|
+
profile: { picture: 'ipsum.jpg' },
|
|
165
|
+
});
|
|
166
|
+
|
|
162
167
|
const users = await querier.findMany(User, {
|
|
163
|
-
$project: { id: true, email: true, profile: ['
|
|
168
|
+
$project: { id: true, email: true, profile: ['picture'] },
|
|
164
169
|
$filter: { email: { $iendsWith: '@google.com' } },
|
|
165
170
|
$sort: { createdAt: -1 },
|
|
166
171
|
$limit: 100,
|
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Spec } from '@uql/core/test';
|
|
2
|
-
import { AbstractSqlDialect } from './abstractSqlDialect';
|
|
3
|
-
export declare abstract class AbstractSqlDialectSpec implements Spec {
|
|
4
|
-
readonly dialect: AbstractSqlDialect;
|
|
5
|
-
constructor(dialect: AbstractSqlDialect);
|
|
6
|
-
shouldBeValidEscapeCharacter(): void;
|
|
7
|
-
shouldBeginTransaction(): void;
|
|
8
|
-
shouldInsertMany(): void;
|
|
9
|
-
shouldInsertOne(): void;
|
|
10
|
-
shouldInsertWithOnInsertId(): void;
|
|
11
|
-
shouldInsertManyWithSpecifiedIdsAndOnInsertIdAsDefault(): void;
|
|
12
|
-
shouldUpdate(): void;
|
|
13
|
-
shouldFind(): void;
|
|
14
|
-
shouldBeSecure(): void;
|
|
15
|
-
shouldFind$and(): void;
|
|
16
|
-
shouldFind$or(): void;
|
|
17
|
-
shouldFind$not(): void;
|
|
18
|
-
shouldFind$nor(): void;
|
|
19
|
-
shouldFind$orAnd$and(): void;
|
|
20
|
-
shouldFindSingle$filter(): void;
|
|
21
|
-
shouldFindMultipleComparisonOperators(): void;
|
|
22
|
-
shouldFind$ne(): void;
|
|
23
|
-
shouldFindIsNull(): void;
|
|
24
|
-
shouldFind$in(): void;
|
|
25
|
-
shouldFind$nin(): void;
|
|
26
|
-
shouldFind$projectFields(): void;
|
|
27
|
-
shouldFind$projectOneToOne(): void;
|
|
28
|
-
shouldFind$projectManyToOne(): void;
|
|
29
|
-
shouldFind$projectWithAllFieldsAndSpecificFieldsAndFilter(): void;
|
|
30
|
-
shouldVirtualField(): void;
|
|
31
|
-
shouldFind$projectDeep(): void;
|
|
32
|
-
shouldFind$group(): void;
|
|
33
|
-
shouldFind$limit(): void;
|
|
34
|
-
shouldFind$skip(): void;
|
|
35
|
-
shouldFind$project(): void;
|
|
36
|
-
shouldDelete(): void;
|
|
37
|
-
shouldFind$projectRaw(): void;
|
|
38
|
-
shouldFind$filterRaw(): void;
|
|
39
|
-
shouldFind$startsWith(): void;
|
|
40
|
-
shouldFind$istartsWith(): void;
|
|
41
|
-
shouldFind$endsWith(): void;
|
|
42
|
-
shouldFind$iendsWith(): void;
|
|
43
|
-
shouldFind$includes(): void;
|
|
44
|
-
shouldFind$iincludes(): void;
|
|
45
|
-
shouldFind$like(): void;
|
|
46
|
-
shouldFind$ilike(): void;
|
|
47
|
-
shouldFind$regex(): void;
|
|
48
|
-
shouldFind$text(): void;
|
|
49
|
-
}
|