# Transaction
Transactions ensure a group of operations either all succeed (commit) or all fail (rollback).
## Using Transactions
```rust,ignore
use zero_postgres::sync::Conn;
Use `tx.commit()` or `tx.rollback()` for explicit control:
```rust,ignore
if some_condition {
tx.commit(conn)
} else {
tx.rollback(conn)
}
})?;
```
## Nested Transactions
Nested transactions are not supported. Calling `transaction` while already in a transaction returns `Error::NestedTransaction`.
## Async Transactions
For async connections, use async closures:
```rust,ignore
use zero_postgres::tokio::Conn;