Hi dear and amazing @AngusGMorrison,
a doubt:
In the repository function create_author I need to call another repository method (example: check_if_author_name_is_already_taken(req.name())) and I need to call it within the same transaction I'm creating on line 50.
How to?
Plus the same method can be called not in a transaction too!
Should I have a new argument on the repository method?
An argument to indicate both a db connection or a db transaction?
Something like:
impl BlogRepository for Sqlite {
async fn create_author(&self, req: &CreateAuthorRequest) -> Result<Author, CreateAuthorError> {}
async fn check_if_author_name_is_already_taken(&self, db_conn_or_tx: ??? what type here ???, name: &str) -> Result<bool, String> {}
}
I'm asking for you help too, @TmLev.