Comparing version 4.0.0 to 4.0.1
@@ -97,1 +97,15 @@ # Connecting | ||
``` | ||
## Driver Configuration | ||
The third argument to the Massive constructor is a [driverConfig](https://vitaly-t.github.io/pg-promise/module-pg-promise.html) object passed directly through to pg-promise. Please consult the pg-promise documentation for more information. | ||
```javascript | ||
massive(connectionInfo, loaderConfig, { | ||
// use native bindings (must be installed separately) | ||
pgNative: true, | ||
// don't log any warnings from the driver | ||
noWarnings: true | ||
}).then(instance => {...}); | ||
``` |
@@ -30,4 +30,6 @@ 'use strict'; | ||
this.columns = _.map(_.keys(this.records[0]), key => `"${key}"`); | ||
this.params = _.flatten(this.records.map(r => _.values(r))); | ||
const keys = _.keys(this.records[0]); | ||
this.columns = _.map(keys, key => `"${key}"`); | ||
this.params = _.reduce(this.records, (params, element) => params.concat(keys.map(key => element[key])), []); | ||
}; | ||
@@ -34,0 +36,0 @@ |
{ | ||
"name": "massive", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "A small query tool for Postgres that embraces json and makes life simpler", | ||
@@ -51,3 +51,3 @@ "homepage": "https://dmfay.github.io/massive-js/", | ||
"lodash": "~4.17.4", | ||
"mz": "~2.6.0", | ||
"mz": "~2.7.0", | ||
"pg-promise": "~6.5.0", | ||
@@ -63,3 +63,3 @@ "pg-query-stream": "~1.0.0" | ||
"jsdoc": "^3.5.4", | ||
"mocha": "~3.2.0", | ||
"mocha": "~3.5.1", | ||
"nyc": "~11.2.0" | ||
@@ -66,0 +66,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# Massive.js 3.0: A Postgres-centric Data Access Tool | ||
# Massive.js: A Postgres-centric Data Access Tool | ||
@@ -56,3 +56,3 @@ [](https://npmjs.org/package/massive) | ||
**Starting with version 3, Massive requires ES6 support and uses Promises exclusively. If you need a callback-based API or are using a pre-6.x release of Node.js, install massive@2 or download version 2.x from [the Releases page](https://github.com/dmfay/massive-js/releases).** | ||
**Starting with version 3.0.0, Massive requires ES6 support and uses Promises exclusively. If you need a callback-based API or are using a pre-6.x release of Node.js, install massive@2 or download version 2.x from [the Releases page](https://github.com/dmfay/massive-js/releases).** | ||
@@ -369,4 +369,6 @@ Examples are presented using the standard `then()` construction for compatibility, but use of ES2017 `async` and `await` or a flow control library such as [co](https://github.com/tj/co) to manage promises is highly recommended. | ||
Persistence functions are also adapted for document tables. You can upsert a document with `saveDoc`; if the argument contains an `id` field, it will update the existing document in the database. Otherwise, it will create a new one. Either way, it returns the current state of the document. | ||
Persistence functions are also adapted for document tables. You can update/insert a document with `saveDoc`; if the argument contains an `id` field, it will update the existing document in the database. If the argument contains no `id` field then it will insert a new document into the database. Either way, it returns the current state of the document. | ||
Note that this isn't a true upsert. It basically checks the id field, if it exists it will do an `UPDATE` query otherwise it will do an `INSERT` query. If you specify an `id` that isn't in the database nothing will get updated and `null` will be returned. | ||
```javascript | ||
@@ -373,0 +375,0 @@ attributes.requiresAuthentication = true; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1522071
2382
440