Fork me on GitHub
#sql
<
2018-06-15
>
bwstearns16:06:37

Is there a good way to wrap multiple yesql calls in a transaction? like (db/transaction (create-user<! user-info) (whitelist-ips<! ip-addresses)) or should everything be done at the sql level?

valtteri16:06:43

You can use jdbc/with-db-transaction macro

bwstearns16:06:54

Awesome. Thanks. Was wondering if yesql was friendly to something like that.

valtteri16:06:41

Yeah if I remember correctly you can pass the transaction where you would pass db-spec to yesql

dadair16:06:25

The only thing to consider is I think yesql has a mode where you pre-provide the db spec, then all calls automatically use it, instead of passing it as an argument every time; to use jdbc/with-db-transaction you’ll need to use the version where the argument is explicit