
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Range type support for node-postgres.
Install pg-range into your existing pg adapter:
var pg = require("pg");
require("pg-range").install(pg);
Then make a query that returns range objects!
client.query("SELECT range FROM table", function (result) {
// result.range = {
// begin: Thu Mar 26 2014 17:57:02 GMT-0400 (EDT),
// end: Thu Mar 27 2014 17:57:02 GMT-0400 (EDT),
// bounds: '[)'
// }
});
Or make a query that inserts range objects:
var Range = require("pg-range").Range;
client.query("INSERT INTO table VALUES ($1)", [Range(1, 3)]);
See the Postgres "Range Types" documentation for details.
pg-range uses stRange.js, a JavaScript range library, to provide a
Range
class with useful methods, like contains
and intersects
.
See the stRange.js API documentation.
Values of (PostgreSQL) type
int4range
int8range
numrange
tsrange
tstzrange
daterange
will be automatically parsed into instances of Range
when the pg-range
type adapter is installed.
Warning: When constructing range objects for use in queries, use the
pg-range Range
constructor as shown above, and not raw stRange.js
Range
objects. Raw stRange.js objects do not provide a toPostgres
method, and will not properly serialize date ranges and empty ranges in
queries!
FAQs
node-postgres plugin to parse range columns
The npm package pg-range receives a total of 4,241 weekly downloads. As such, pg-range popularity was classified as popular.
We found that pg-range demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.