-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
33 lines (30 loc) · 1.11 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var pg = require('./');
console.log(pg);
pg.connect("postgres://postgres:hidden@localhost:5433/sampledb");
// wait 2 seconds to confirm the connection and initilize the object.
setTimeout(function () {
if (pg.isReady()){
pg.create('person', {name: 'Kalidia Millette', position: 'Cow Mechanic', rank: '...'}, function (err, result){
console.log(err, result);
// var recent = result.insertedIds[0];
pg.retrieve('person', {name: 'Kalidia Millette'}, function (err, result) {
console.log(err, result);
pg.update('person', {rank: 'Novice'} ,function (err, result){
console.log(err, result);
pg.retrieve('person', {name: 'Kalidia Millette'}, function (err, result) {
console.log(err, result);
pg.delete('person', {name: 'Bob'}, function (err, result) {
console.log(err, result);
pg.retrieve('person', {name: 'Kalidia Millette'}, function (err, result) {
console.log(err, result);
});
})
});
})
});
});
}
else {
console.log('Database not ready');
}
}, 2000);