New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

massive

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

massive - npm Package Compare versions

Comparing version 4.7.2 to 4.8.0

13

docs/queries.md

@@ -101,1 +101,14 @@ # Queries

```
## refresh
`refresh` can be used with [materialized views](https://www.postgresql.org/docs/current/static/rules-materializedviews.html), which cache the view query results to sacrifice realtime updates for performance. Materialized views must be refreshed whenever you need to ensure the information in them is up to date.
Materialized views ordinarily block reads while refreshing. To avoid this, invoke the function passing `true` to specify a concurrent refresh.
`refresh` returns an empty query result.
```javascript
db.cached_statistics.refresh(true) // concurrently
.then(() => {...});
```

25

lib/queryable.js

@@ -17,3 +17,4 @@ 'use strict';

* @extends Entity
* @param {Object} spec - An {@linkcode Entity} specification representing a queryable:
* @param {Object} spec - An {@linkcode Entity} specification representing a
* queryable:
* @param {Object} spec.db - A {@linkcode Database}.

@@ -23,5 +24,9 @@ * @param {String} spec.name - The table or view's name.

* view.
* @param {Boolean} [spec.is_matview] - Whether the object is a materialized view
* (default false).
*/
const Queryable = function () {
const Queryable = function (spec) {
Entity.apply(this, arguments);
this.isMatview = spec.is_matview || false;
};

@@ -112,2 +117,18 @@

/**
* Refresh a materialized view.
*
* @param {Boolean} [concurrently] - Do it without locking reads.
* @return {Promise} A query with no results.
*/
Queryable.prototype.refresh = function (concurrently) {
if (!this.isMatview) {
return this.db.$p.reject(new Error(`${this.delimitedName} is not a materialized view`));
}
const concurrentlyStr = concurrently ? 'CONCURRENTLY' : '';
return this.db.query(`REFRESH MATERIALIZED VIEW ${concurrentlyStr} ${this.delimitedName}`);
};
/**
* Determine whether criteria represent a search by primary key. If a number or

@@ -114,0 +135,0 @@ * uuid are passed, it is assumed to be a primary key value; if an object, it

6

package.json
{
"name": "massive",
"version": "4.7.2",
"version": "4.8.0",
"description": "A small query tool for Postgres that embraces json and makes life simpler",

@@ -58,3 +58,3 @@ "homepage": "https://dmfay.github.io/massive-js/",

"lodash": "~4.17.4",
"pg-promise": "~8.2.0",
"pg-promise": "~8.4.0",
"pg-query-stream": "~1.1.1"

@@ -70,3 +70,3 @@ },

"mocha": "~5.1.0",
"nyc": "~11.6.0"
"nyc": "~11.7.1"
},

@@ -73,0 +73,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc