impl_executor_transaction

Macro impl_executor_transaction 

Source
macro_rules! impl_executor_transaction {
    ($driver:ty, $transaction:ident $(< $lt:lifetime >)?, $connection:ident) => { ... };
}
Expand description

Implement the Executor trait for a transaction wrapper type by delegating each operation to an underlying connection object.

This reduces boilerplate across driver implementations. The macro expands into an impl Executor for $transaction<'c> with forwarding methods for prepare, run, fetch, execute, and append.

Parameters:

  • $driver: concrete driver type.
  • $transaction: transaction wrapper type (generic over lifetime 'c).
  • $connection: field name on the transaction pointing to the connection.

§Examples

use crate::{YourDBConnection, YourDBDriver};
use tank_core::{Error, Result, Transaction, impl_executor_transaction};

pub struct YourDBTransaction<'c> {
    connection: &'c mut YourDBConnection,
}

impl_executor_transaction!(YourDBDriver, YourDBTransaction<'c>, connection);

impl<'c> Transaction<'c> for YourDBTransaction<'c> { ... }