@superhero/db 0.3.0 → 0.4.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.
Files changed (2) hide show
  1. package/index.js +16 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  const
2
- util = require('util'),
3
- fs = require('fs'),
4
- promisify = util.promisify,
5
- readFile = promisify(fs.readFile)
2
+ util = require('util'),
3
+ fs = require('fs'),
4
+ promisify = util.promisify,
5
+ readFile = promisify(fs.readFile)
6
6
 
7
7
  class Db
8
8
  {
@@ -22,8 +22,18 @@ class Db
22
22
  async query(file, ...ctx)
23
23
  {
24
24
  const
25
- query = await this.getQuery(file),
26
- response = await this.adaptor.query(query, ...ctx)
25
+ query = await this.getQuery(file),
26
+ response = await this.adaptor.query(query, ...ctx)
27
+
28
+ return response
29
+ }
30
+
31
+ async formatQuery(file, formatCtx, sqlCtx)
32
+ {
33
+ const
34
+ query = await this.getQuery(file),
35
+ formattedQuery = util.format(query, ...formatCtx),
36
+ response = await this.adaptor.query(formattedQuery, ...sqlCtx)
27
37
 
28
38
  return response
29
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superhero/db",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Db interaction, designed to separate queries from the source code",
5
5
  "repository": "git@github.com:superhero/js.db.git",
6
6
  "main": "index.js",