0.5.0 • Published 3 years ago

minipg v0.5.0

Weekly downloads
3
License
BSD
Repository
github
Last release
3 years ago

minipg Build Status

High performance libpq bindings. The main feature is single row mode to support massive result sets without consuming the entire result set into memory. node-postgres is the standard postgres library, but it requires the entire result set to be read into memory before processing it. There is also pg-cursor on top of it, which helps, but it relies on server-side cursors (portals) which aren't compatible in all scenarios where session-level postgres features don't work (e.g. a production system running pgbouncer connection pooling).

This is not a fully functional postgres client, but it could be one day. It's still in early development.

Installation

npm install minipg

Example

import { Client } from 'minipg';

const client = new Client().connect('dbname = postgres');

const sql = 'SELECT generate_series(1, 4000000000)';

// query an essentially infinite series of results
client.query(sql).each(function(err, finished, columns, row, index) {
  // `err` is a possible error message
  // `finished` indicates that the iteration is complete
  // `columns` an object containing the column definitions
  // `row` is the row object with the row data in it
  // `index` is the index of this row in the result set
  console.log(index);

  if (finished) {
    // the end was reached
    client.close();
  }
});
0.5.0

3 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago