elgris / sqrl

Fluent SQL generation for golang
MIT License
279 stars 38 forks source link

Add support for Query and QueryRow in UPDATE and DELETE statements #20

Closed lokhman closed 6 years ago

lokhman commented 6 years ago

PostgreSQL allows to build the following queries:

UPDATE tbl SET col1 = 'val' WHERE id = 1 RETURNING col2;

DELETE FROM tbl WHERE id = 1 RETURNING col1;

This patch will allow to call Query, QueryRow and Scan directly from UpdateBuilder and DeleteBuilder.

elgris commented 6 years ago

Thanks for the patch! However, could you please add tests that cover introduced functionality? For instance, here you can find an example of testing Query-like methods and here - testing of the errors

elgris commented 6 years ago

thanks @lokhman !