> For the complete documentation index, see [llms.txt](https://innoway.gitbook.io/innoway/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://innoway.gitbook.io/innoway/tai-lieu/sdk/pg.md).

# pg

Innoway tích hợp bộ cộng cụ node-postgres giúp người dùng kết nối và thao tác trực tiếp với database Postgres

Chi tiết xem [tại đây](https://node-postgres.com/apis/client)

Ví dụ sử dụng

```javascript
const client = new pg.Client({
  host: '{{host}}',
  port: {{port}},
  database: '{{database}}',
  user: '{{user}}',
  password: {{password}},
})

await client.connect()

let insertDataText = 'INSERT INTO test(name, age) VALUES ($1, $2)'
let insertDataValues = ['Innoway', 2]
const res = await client.query(insertDataText, insertDataValues)

await client.end()

return {}
```
