Function tx_select

Source
pub async fn tx_select<'a, T, R, F>(
    transaction: Transaction<'a>,
    entity: T,
    to_model: F,
) -> Result<(Transaction<'a>, R), Error>
where T: SqlQuery + SqlParams, F: FnOnce(&Row) -> Result<R, Error>,
Expand description

§tx_select

Retrieves a single record using a custom transformation function within a transaction.

§Parameters

  • transaction: Active transaction object
  • entity: Query parameters (must implement SqlQuery and SqlParams traits)
  • to_model: Function to transform the row into the desired type

§Return Value

  • Result<(Transaction<'_>, R), Error>: On success, returns the transaction and the transformed record