File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ connect: the function to get a connection from the pool
1919pool: the pool instance
2020Client: a client constructor for a single query
2121query: a utility to perform a query _without_ a transaction
22- transact: a utility to perform a query _with_ a transaction
22+ transact: a utility to perform multiple queries _with_ a transaction
2323```
2424
2525Example:
@@ -106,8 +106,9 @@ fastify.register(require('fastify-postgres'), {
106106})
107107
108108fastify .post (' /user/:username' , (req , reply ) => {
109- fastify .pg .transact (
110- ' INSERT INTO users(username) VALUES($1) RETURNING id' , [req .params .username ],
109+ fastify .pg .transact (async client => {
110+ return client .query (' INSERT INTO users(username) VALUES($1) RETURNING id' , [req .params .username ])
111+ },
111112 function onResult (err , result ) {
112113 reply .send (err || result)
113114 }
You can’t perform that action at this time.
0 commit comments