Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
cemremengu committed Sep 21, 2018
1 parent 80761b5 commit 2b674e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ connect: the function to get a connection from the pool
pool: the pool instance
Client: a client constructor for a single query
query: a utility to perform a query _without_ a transaction
transact: a utility to perform a query _with_ a transaction
transact: a utility to perform multiple queries _with_ a transaction
```

Example:
Expand Down Expand Up @@ -106,8 +106,9 @@ fastify.register(require('fastify-postgres'), {
})

fastify.post('/user/:username', (req, reply) => {
fastify.pg.transact(
'INSERT INTO users(username) VALUES($1) RETURNING id', [req.params.username],
fastify.pg.transact(async client => {
return client.query('INSERT INTO users(username) VALUES($1) RETURNING id', [req.params.username])
},
function onResult (err, result) {
reply.send(err || result)
}
Expand Down

0 comments on commit 2b674e3

Please sign in to comment.