2

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='test@example.com'
                     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

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Or Yaacov
  • 3,597
  • 5
  • 25
  • 49

0 Answers0