When I write a function to interact with the database, that function generally doesn't care if it runs inside a transaction, or directly on the client. To enable executor agnostic functions, I suggest adding a trait QueryExecutor so such function can take an impl QueryExecutor instead of &Client or &mut Transaction.
This would also simplify the code generated by @ifiokjr's codegen which currently has to generate two methods query and transaction for each query.
When I write a function to interact with the database, that function generally doesn't care if it runs inside a transaction, or directly on the client. To enable executor agnostic functions, I suggest adding a trait
QueryExecutor
so such function can take animpl QueryExecutor
instead of&Client
or&mut Transaction
.This would also simplify the code generated by @ifiokjr's codegen which currently has to generate two methods
query
andtransaction
for each query.