Begin a new transaction This is called internally by `Session::transaction()`. The transaction will automatically roll back when dropped unless committed.
(session: &'conn Session)
| 62 | /// This is called internally by `Session::transaction()`. |
| 63 | /// The transaction will automatically roll back when dropped unless committed. |
| 64 | pub(crate) fn begin(session: &'conn Session) -> Result<Self> { |
| 65 | // Execute BEGIN TRANSACTION |
| 66 | session |
| 67 | .coordinator() |
| 68 | .process_query("BEGIN TRANSACTION", session.id()) |
| 69 | .map_err(|e| Error::Transaction(format!("Failed to begin transaction: {}", e)))?; |
| 70 | |
| 71 | Ok(Transaction { |
| 72 | session, |
| 73 | committed: false, |
| 74 | drop_behavior: DropBehavior::Rollback, |
| 75 | }) |
| 76 | } |
| 77 | |
| 78 | /// Execute a GQL statement within this transaction |
| 79 | /// |
nothing calls this directly
no test coverage detected