New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pg-lsn

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-lsn

PostgreSQL LSN comparison library

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

node-pg-lsn

Constants and functions for working with postgres xlog positions. This module makes a number of assumptions about the format of xlog positions. It's not totally clear that this is a committed Postgres interface, but it seems to be true.

We assume that postgres xlog positions are represented as strings of the form:

filepart/offset		e.g., "0/17BB660"

where both "filepart" and "offset" are hexadecimal numbers. xlog position F1/O1 is at least as new as F2/O2 if (F1 > F2) or (F1 == F2 and O1 >= O2). We try to avoid assuming that they're zero-padded (i.e., that a simple string comparison might do the right thing). We also don't make any assumptions about the size of each file, which means we can't compute the actual difference between two positions.

Usage

var assert = require('assert');
var lsn = require('pg-lsn');

var locationOne = '2D7/0';
var locationTwo = '2D6/FEFFE770';
var comparison = lsn.xlogCompare(locationOne, locationTwo);

if (comparison === 0) {
    console.log('locations are the same');
} else if(comparison > 0) {
    console.log('locationOne is greater than locationTwo');
} else {
    assert.ok(comparison < 0);
    console.log('locationOne is less than locationTwo');
}

FAQs

Package last updated on 20 Oct 2017

Did you know?

Socket

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.

Install

Related posts