postgres-pdo
Version:
Postgres Data Objects
71 lines (53 loc) • 939 B
Markdown
for https://github.com/porsager/postgres
```aidl
$ npm i -S postgres-pdo
```
```aidl
const postgres = require('postgres');
const Pdo = require('postgres-pdo');
const options = {
// Connection parameters
}
const sql = postgres(options);
const pdo = new Pdo(sql);
```
```aidl
const result = await pdo
.select()
.from('table_name')
.whereIn('id', [1, 2])
.orWhere('id', '=', 3)
.execute();
console.log(result);
```
```aidl
await pdo
.insert(['name', 'age'])
.into('table_name')
.values(['John', 30])
.execute();
```
```aidl
await pdo
.update({
name: 'John',
age: 30
})
.table('table_name')
.where('id', '=', 1)
.execute();
```
```aidl
await pdo
.delete('table_name')
.where('id', '>', 1)
.execute();
```
Pdo wrapper