Adds an efficient method of executing multiple queries inside a transaction.
Automatically adds a transaction around the call (disabled with transaction: false)
Executes many queries (pipelined in postgrex's case for 1 round trip)
Stops executing on first error and just returns the error
If inside a transaction rolls back the transaction on error
All decoding delayed until after the transaction is committed (potentially after checking in the connection)
All logging delayed until after the transaction (potentially after checking in the connection)
This means we can execute any number of queries inside a transaction and not block the connection at all to log or decode. Also in postgrex it would only take 3 round trips, however many queries are executed, when wrapping with a transaction.
The caveat is that queries must be prepared beforehand.
Potential issues:
Ignores results of successful queries if there is an error
decode_mapper breaks down as its set for all queries, should the API be extended to set per query options? Would that make this too complicated to use?
Do we want to commit a transaction we cant decode?
Adds an efficient method of executing multiple queries inside a transaction.
transaction: false
)This means we can execute any number of queries inside a transaction and not block the connection at all to log or decode. Also in postgrex it would only take 3 round trips, however many queries are executed, when wrapping with a transaction.
The caveat is that queries must be prepared beforehand.
Potential issues: