How to use returning clause on update/upsert

389 Views Asked by At

I wish to know how I can use postgres returning clause with SQL Boiler elegantly.

For example I wish to update some object by some fields and return the object id:

 err = queries.RawG(`update users
                     set name='test-name'
                     WHERE email='[email protected]'
                     RETURNING id`).Bind(ctx, boil.GetDB(), &user)

The following is working as expected, the user column has been updated and I got back the user id, but I'm looking for more elegant ways to do the same without using queries.RawG

0

There are 0 best solutions below