rado 0.2.6 → 0.2.8
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 +5 -4
- package/dist/define/Column.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Fully typed, lightweight TypeScript query builder.
|
|
4
4
|
Currently focused on SQLite.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
npm install rado
|
|
8
|
-
```
|
|
6
|
+
<pre>npm install <a href="https://www.npmjs.com/package/rado">rado</a></pre>
|
|
9
7
|
|
|
10
8
|
- Definition via TypeScript types
|
|
11
9
|
- Composable queries
|
|
@@ -109,9 +107,12 @@ User({id: 1}).innerJoin(Post({userId: User.id})).select({
|
|
|
109
107
|
Create expressions to select complex values:
|
|
110
108
|
|
|
111
109
|
```ts
|
|
110
|
+
import {iif} from 'rado/sqlite'
|
|
112
111
|
Person().select({
|
|
113
112
|
name: Person.firstName.concat(' ').concat(Person.lastName),
|
|
114
|
-
isMario: Person.firstName.is('Mario')
|
|
113
|
+
isMario: Person.firstName.is('Mario'),
|
|
114
|
+
isActor: Person.id.isIn(Actor().select(Actor.personId)),
|
|
115
|
+
email: iif(Person.email.isNotNull(), Person.email, 'its.me@mario')
|
|
115
116
|
})
|
|
116
117
|
```
|
|
117
118
|
|
package/dist/define/Column.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare namespace Column {
|
|
|
35
35
|
const isPrimary: unique symbol;
|
|
36
36
|
}
|
|
37
37
|
interface ValueColumn<T> extends Expr<T> {
|
|
38
|
-
<X = T>(): ValueColumn<T extends null ? X | null : T extends Array<any> ? Array<X> : X>;
|
|
38
|
+
<X = T>(): ValueColumn<T extends X ? X : Array<any> | null extends T ? Array<X> | null : T extends Array<any> ? Array<X> : T extends null ? X | null : X>;
|
|
39
39
|
}
|
|
40
40
|
declare class ValueColumn<T> extends Callable implements Column<T> {
|
|
41
41
|
[Column.type]: T;
|
|
@@ -55,7 +55,7 @@ export declare class PrimaryColumn<T, K> extends ValueColumn<PrimaryKey<T, K>> {
|
|
|
55
55
|
[Column.isPrimary]: K;
|
|
56
56
|
}
|
|
57
57
|
interface ObjectColumn<T> {
|
|
58
|
-
<X = T>(): Column<T extends null ? X | null : X> & Fields<X>;
|
|
58
|
+
<X = T>(): Column<T extends X ? X : T extends null ? X | null : X> & Fields<X>;
|
|
59
59
|
}
|
|
60
60
|
declare class ObjectColumn<T> extends Callable implements Column<T> {
|
|
61
61
|
[Column.type]: T;
|