doix-db 1.0.20 → 1.0.21

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.
Files changed (2) hide show
  1. package/lib/DbClient.js +22 -0
  2. package/package.json +1 -1
package/lib/DbClient.js CHANGED
@@ -125,6 +125,28 @@ class DbClient extends EventEmitter {
125
125
 
126
126
  }
127
127
 
128
+ async insert (name, data, options = {}) {
129
+
130
+ const params = this.lang.genInsertParamsSql (name, data, options)
131
+
132
+ const sql = params.pop ()
133
+
134
+ await this.do (sql, params)
135
+
136
+ }
137
+
138
+ async update (name, data, options = {}) {
139
+
140
+ const params = this.lang.genUpdateParamsSql (name, data, options)
141
+
142
+ if (params === null) return
143
+
144
+ const sql = params.pop ()
145
+
146
+ await this.do (sql, params)
147
+
148
+ }
149
+
128
150
  async getStream (q, p = [], options = {}) {
129
151
 
130
152
  const call = this.call (q, p, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doix-db",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Shared database related code for doix",
5
5
  "main": "index.js",
6
6
  "files": [