2010-10-16 07:21:24 +08:00
|
|
|
#pg.js
|
2010-10-23 07:26:18 +08:00
|
|
|
Async Pure JavaScript PostgreSQL driver for node.js
|
2010-10-16 07:21:24 +08:00
|
|
|
|
2010-10-17 08:45:05 +08:00
|
|
|
## ALPHA version
|
2010-10-16 07:21:24 +08:00
|
|
|
|
2010-10-23 07:26:18 +08:00
|
|
|
Implemented in a fully TDD fashion. Drew major inspiration from
|
|
|
|
[postgres-js](http://github.com/creationix/postgres-js) but it has 0 tests and
|
|
|
|
doesn't seem to be actively developed anymore. I'm aiming for
|
|
|
|
extremely high quality code, but first doing the implementation and
|
|
|
|
only refactoring after tests are in place.
|
|
|
|
|
|
|
|
I'm first aiming to support the low level [messaging
|
|
|
|
protocol](http://developer.postgresql.org/pgdocs/postgres/protocol.html).
|
|
|
|
|
|
|
|
Due to the fully async nature of node sockets, the driver is
|
|
|
|
completely non-blocking.
|
2010-10-17 08:45:05 +08:00
|
|
|
|
|
|
|
### What works?
|
|
|
|
|
|
|
|
var client = new Client({
|
|
|
|
username: 'brianc',
|
|
|
|
database: 'postgres'
|
|
|
|
});
|
|
|
|
|
|
|
|
client.connect();
|
|
|
|
|
|
|
|
client.query('select typname, oid from pg_type');
|
2010-10-16 07:21:24 +08:00
|
|
|
|
2010-10-17 08:45:05 +08:00
|
|
|
query.on('row', function(row) {
|
|
|
|
console.log('type name: ' + row[0] + ' oid: ' + row[1]);
|
|
|
|
};
|
2010-09-29 11:09:21 +08:00
|
|
|
|
2010-10-17 08:45:05 +08:00
|
|
|
query.on('end') {
|
2010-10-23 07:28:10 +08:00
|
|
|
client.end();
|
2010-10-17 08:45:05 +08:00
|
|
|
};
|
2010-10-23 07:26:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
- prepared statements
|
|
|
|
- parameters
|
|
|
|
- caching
|
2010-10-24 01:49:23 +08:00
|
|
|
- portals
|
2010-10-23 07:26:18 +08:00
|
|
|
- integration testing
|
|
|
|
- notification api
|
|
|
|
- setting parameters
|
|
|
|
- connection pooling
|
|
|
|
- copy data
|
|
|
|
- connection pooling
|