@faasjs/knex 1.4.2 → 1.6.0
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 +10 -156
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,174 +1,28 @@
|
|
|
1
1
|
# @faasjs/knex
|
|
2
2
|
|
|
3
|
-
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/knex/LICENSE)
|
|
4
|
-
[](https://www.npmjs.com/package/@faasjs/knex)
|
|
5
|
-
[](https://www.npmjs.com/package/@faasjs/knex)
|
|
6
|
-
|
|
7
3
|
FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
|
|
8
4
|
|
|
5
|
+
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/knex/LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/@faasjs/knex)
|
|
7
|
+
|
|
9
8
|
## Install
|
|
10
9
|
|
|
11
10
|
```sh
|
|
12
11
|
npm install @faasjs/knex
|
|
13
12
|
```
|
|
14
13
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
### Classes
|
|
14
|
+
## Classes
|
|
18
15
|
|
|
19
16
|
- [Knex](classes/Knex.md)
|
|
20
17
|
|
|
21
|
-
### Type Aliases
|
|
22
|
-
|
|
23
|
-
- [KnexConfig](#knexconfig)
|
|
24
|
-
|
|
25
|
-
### Functions
|
|
26
|
-
|
|
27
|
-
- [originKnex](#originknex)
|
|
28
|
-
- [query](#query)
|
|
29
|
-
- [raw](#raw)
|
|
30
|
-
- [transaction](#transaction)
|
|
31
|
-
- [useKnex](#useknex)
|
|
32
|
-
|
|
33
18
|
## Type Aliases
|
|
34
19
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Ƭ **KnexConfig**: `Object`
|
|
38
|
-
|
|
39
|
-
#### Type declaration
|
|
40
|
-
|
|
41
|
-
| Name | Type |
|
|
42
|
-
| :------ | :------ |
|
|
43
|
-
| `config?` | `OriginKnex.Config` |
|
|
44
|
-
| `name?` | `string` |
|
|
20
|
+
- [KnexConfig](type-aliases/KnexConfig.md)
|
|
45
21
|
|
|
46
22
|
## Functions
|
|
47
23
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
#### Type parameters
|
|
55
|
-
|
|
56
|
-
| Name | Type |
|
|
57
|
-
| :------ | :------ |
|
|
58
|
-
| `TRecord` | extends `Object` = `any` |
|
|
59
|
-
| `TResult` | `unknown`[] |
|
|
60
|
-
|
|
61
|
-
#### Parameters
|
|
62
|
-
|
|
63
|
-
| Name | Type |
|
|
64
|
-
| :------ | :------ |
|
|
65
|
-
| `config` | `string` \| `Config`\<`any`\> |
|
|
66
|
-
|
|
67
|
-
#### Returns
|
|
68
|
-
|
|
69
|
-
`Knex`\<`TRecord`, `TResult`\>
|
|
70
|
-
|
|
71
|
-
___
|
|
72
|
-
|
|
73
|
-
### query
|
|
74
|
-
|
|
75
|
-
▸ **query**\<`TName`\>(`table`): `OriginKnex.QueryBuilder`\<`OriginKnex.TableType`\<`TName`\>, \{ `_aliases`: {} ; `_base`: `OriginKnex.ResolveTableType`\<`OriginKnex.TableType`\<`TName`\>, ``"base"``\> ; `_hasSelection`: ``false`` ; `_intersectProps`: {} ; `_keys`: `never` ; `_single`: ``false`` ; `_unionProps`: `never` }[]\>
|
|
76
|
-
|
|
77
|
-
#### Type parameters
|
|
78
|
-
|
|
79
|
-
| Name | Type |
|
|
80
|
-
| :------ | :------ |
|
|
81
|
-
| `TName` | extends ``"test"`` |
|
|
82
|
-
|
|
83
|
-
#### Parameters
|
|
84
|
-
|
|
85
|
-
| Name | Type |
|
|
86
|
-
| :------ | :------ |
|
|
87
|
-
| `table` | `TName` |
|
|
88
|
-
|
|
89
|
-
#### Returns
|
|
90
|
-
|
|
91
|
-
`OriginKnex.QueryBuilder`\<`OriginKnex.TableType`\<`TName`\>, \{ `_aliases`: {} ; `_base`: `OriginKnex.ResolveTableType`\<`OriginKnex.TableType`\<`TName`\>, ``"base"``\> ; `_hasSelection`: ``false`` ; `_intersectProps`: {} ; `_keys`: `never` ; `_single`: ``false`` ; `_unionProps`: `never` }[]\>
|
|
92
|
-
|
|
93
|
-
▸ **query**\<`TName`, `TResult`\>(`table`): `OriginKnex.QueryBuilder`\<`TName`, `TResult`\>
|
|
94
|
-
|
|
95
|
-
#### Type parameters
|
|
96
|
-
|
|
97
|
-
| Name | Type |
|
|
98
|
-
| :------ | :------ |
|
|
99
|
-
| `TName` | extends `Object` = `any` |
|
|
100
|
-
| `TResult` | `any`[] |
|
|
101
|
-
|
|
102
|
-
#### Parameters
|
|
103
|
-
|
|
104
|
-
| Name | Type |
|
|
105
|
-
| :------ | :------ |
|
|
106
|
-
| `table` | `string` |
|
|
107
|
-
|
|
108
|
-
#### Returns
|
|
109
|
-
|
|
110
|
-
`OriginKnex.QueryBuilder`\<`TName`, `TResult`\>
|
|
111
|
-
|
|
112
|
-
___
|
|
113
|
-
|
|
114
|
-
### raw
|
|
115
|
-
|
|
116
|
-
▸ **raw**\<`TResult`\>(`sql`, `bindings?`): `Promise`\<`TResult`\>
|
|
117
|
-
|
|
118
|
-
#### Type parameters
|
|
119
|
-
|
|
120
|
-
| Name | Type |
|
|
121
|
-
| :------ | :------ |
|
|
122
|
-
| `TResult` | `any` |
|
|
123
|
-
|
|
124
|
-
#### Parameters
|
|
125
|
-
|
|
126
|
-
| Name | Type | Default value |
|
|
127
|
-
| :------ | :------ | :------ |
|
|
128
|
-
| `sql` | `string` | `undefined` |
|
|
129
|
-
| `bindings` | `ValueDict` \| `RawBinding`[] | `[]` |
|
|
130
|
-
|
|
131
|
-
#### Returns
|
|
132
|
-
|
|
133
|
-
`Promise`\<`TResult`\>
|
|
134
|
-
|
|
135
|
-
___
|
|
136
|
-
|
|
137
|
-
### transaction
|
|
138
|
-
|
|
139
|
-
▸ **transaction**\<`TResult`\>(`scope`, `config?`, `options?`): `Promise`\<`TResult` \| `void`\>
|
|
140
|
-
|
|
141
|
-
#### Type parameters
|
|
142
|
-
|
|
143
|
-
| Name | Type |
|
|
144
|
-
| :------ | :------ |
|
|
145
|
-
| `TResult` | `any` |
|
|
146
|
-
|
|
147
|
-
#### Parameters
|
|
148
|
-
|
|
149
|
-
| Name | Type |
|
|
150
|
-
| :------ | :------ |
|
|
151
|
-
| `scope` | (`trx`: `Transaction`\<`any`, `any`\>) => `void` \| `Promise`\<`TResult`\> |
|
|
152
|
-
| `config?` | `TransactionConfig` |
|
|
153
|
-
| `options?` | `Object` |
|
|
154
|
-
| `options.trx?` | `Transaction`\<`any`, `any`[]\> |
|
|
155
|
-
|
|
156
|
-
#### Returns
|
|
157
|
-
|
|
158
|
-
`Promise`\<`TResult` \| `void`\>
|
|
159
|
-
|
|
160
|
-
___
|
|
161
|
-
|
|
162
|
-
### useKnex
|
|
163
|
-
|
|
164
|
-
▸ **useKnex**(`config?`): `UseifyPlugin`\<[`Knex`](classes/Knex.md)\>
|
|
165
|
-
|
|
166
|
-
#### Parameters
|
|
167
|
-
|
|
168
|
-
| Name | Type |
|
|
169
|
-
| :------ | :------ |
|
|
170
|
-
| `config?` | [`KnexConfig`](#knexconfig) |
|
|
171
|
-
|
|
172
|
-
#### Returns
|
|
173
|
-
|
|
174
|
-
`UseifyPlugin`\<[`Knex`](classes/Knex.md)\>
|
|
24
|
+
- [originKnex](functions/originKnex.md)
|
|
25
|
+
- [query](functions/query.md)
|
|
26
|
+
- [raw](functions/raw.md)
|
|
27
|
+
- [transaction](functions/transaction.md)
|
|
28
|
+
- [useKnex](functions/useKnex.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,20 @@ import { Logger } from '@faasjs/logger';
|
|
|
3
3
|
import knex, { Knex as Knex$1 } from 'knex';
|
|
4
4
|
export { Knex as OriginKnex } from 'knex';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
|
|
8
|
+
*
|
|
9
|
+
* [](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/knex/LICENSE)
|
|
10
|
+
* [](https://www.npmjs.com/package/@faasjs/knex)
|
|
11
|
+
*
|
|
12
|
+
* ## Install
|
|
13
|
+
*
|
|
14
|
+
* ```sh
|
|
15
|
+
* npm install @faasjs/knex
|
|
16
|
+
* ```
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
6
20
|
/**
|
|
7
21
|
* Origin [knex](https://knexjs.org/) instance.
|
|
8
22
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,20 @@ import { Logger } from '@faasjs/logger';
|
|
|
3
3
|
import knex, { Knex as Knex$1 } from 'knex';
|
|
4
4
|
export { Knex as OriginKnex } from 'knex';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* FaasJS's sql plugin, base on [Knex](https://knexjs.org/).
|
|
8
|
+
*
|
|
9
|
+
* [](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/knex/LICENSE)
|
|
10
|
+
* [](https://www.npmjs.com/package/@faasjs/knex)
|
|
11
|
+
*
|
|
12
|
+
* ## Install
|
|
13
|
+
*
|
|
14
|
+
* ```sh
|
|
15
|
+
* npm install @faasjs/knex
|
|
16
|
+
* ```
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
6
20
|
/**
|
|
7
21
|
* Origin [knex](https://knexjs.org/) instance.
|
|
8
22
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/knex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@faasjs/deep_merge": "1.
|
|
25
|
-
"@faasjs/func": "1.
|
|
26
|
-
"@faasjs/logger": "1.
|
|
24
|
+
"@faasjs/deep_merge": "1.6.0",
|
|
25
|
+
"@faasjs/func": "1.6.0",
|
|
26
|
+
"@faasjs/logger": "1.6.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"knex": "*"
|