@uql/core 0.4.90 → 0.4.93
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 +33 -33
- package/package.json +3 -3
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,7 +151,7 @@ export class MeasureUnit {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
### <a name="query-data"></a> Query the data
|
|
155
155
|
|
|
156
156
|
```ts
|
|
157
157
|
import { getQuerier } from '@uql/core';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://uql.io",
|
|
4
4
|
"description": "flexible and efficient ORM, with declarative JSON syntax and smart type-safety",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.4.
|
|
6
|
+
"version": "0.4.93",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"tslib": "^2.3.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/node": "^17.0.
|
|
21
|
+
"@types/node": "^17.0.25",
|
|
22
22
|
"@types/sqlstring": "^2.3.0",
|
|
23
23
|
"@types/uuid": "^8.3.4",
|
|
24
24
|
"copyfiles": "^2.4.1",
|
|
@@ -60,4 +60,4 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"gitHead": "de14434cdb450f2cf46017fb77370eeea2c3a5c4"
|
|
63
|
-
}
|
|
63
|
+
}
|