doix-db 1.0.20 → 1.0.22
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 +6 -6
- package/lib/DbClient.js +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
# node-doix-db
|
|
5
5
|
`doix-db` is a plug in for [doix](https://github.com/do-/node-doix) framework implementing a common interface to relational databases. It features:
|
|
6
|
-
* [DbClient](DbClient) — the database API available to `doix` [Job](https://github.com/do-/node-doix/wiki/Job)s;
|
|
7
|
-
* [DbModel](DbModel) — the set of classes representing the database structure;
|
|
8
|
-
* [DbQuery](DbQuery) — a `DbModel` based `SELECT` builder;
|
|
9
|
-
* [DbMigrationPlan](DbMigrationPlan) — a
|
|
10
|
-
* [DbLang](DbLang) — a set of SQL generating functions for miscellaneous application tasks.
|
|
6
|
+
* [DbClient](https://github.com/do-/node-doix-db/wiki/DbClient) — the database API available to `doix` [Job](https://github.com/do-/node-doix/wiki/Job)s;
|
|
7
|
+
* [DbModel](https://github.com/do-/node-doix-db/wiki/DbModel) — the set of classes representing the database structure;
|
|
8
|
+
* [DbQuery](https://github.com/do-/node-doix-db/wiki/DbQuery) — a `DbModel` based `SELECT` builder;
|
|
9
|
+
* [DbMigrationPlan](https://github.com/do-/node-doix-db/wiki/DbMigrationPlan) — a `DbModel` based deployment automation tool;
|
|
10
|
+
* [DbLang](https://github.com/do-/node-doix-db/wiki/DbLang) — a set of SQL generating functions for miscellaneous application tasks.
|
|
11
11
|
|
|
12
|
-
* More information is available at https://github.com/do-/node-doix-db/wiki
|
|
12
|
+
* More information is available at https://github.com/do-/node-doix-db/wiki
|
package/lib/DbClient.js
CHANGED
|
@@ -121,10 +121,34 @@ class DbClient extends EventEmitter {
|
|
|
121
121
|
|
|
122
122
|
await call.exec ()
|
|
123
123
|
|
|
124
|
+
call.finish ()
|
|
125
|
+
|
|
124
126
|
return call
|
|
125
127
|
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
async insert (name, data, options = {}) {
|
|
131
|
+
|
|
132
|
+
const params = this.lang.genInsertParamsSql (name, data, options)
|
|
133
|
+
|
|
134
|
+
const sql = params.pop ()
|
|
135
|
+
|
|
136
|
+
await this.do (sql, params)
|
|
137
|
+
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async update (name, data, options = {}) {
|
|
141
|
+
|
|
142
|
+
const params = this.lang.genUpdateParamsSql (name, data, options)
|
|
143
|
+
|
|
144
|
+
if (params === null) return
|
|
145
|
+
|
|
146
|
+
const sql = params.pop ()
|
|
147
|
+
|
|
148
|
+
await this.do (sql, params)
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
128
152
|
async getStream (q, p = [], options = {}) {
|
|
129
153
|
|
|
130
154
|
const call = this.call (q, p, {
|