pub struct Transaction<'a> { /* private fields */ }
Expand description

A representation of a PostgreSQL database transaction.

Transactions will implicitly roll back by default when dropped. Use the commit method to commit the changes made in the transaction. Transactions can be nested, with inner transactions implemented via savepoints.

Implementations

Consumes the transaction, committing all changes made within it.

Rolls the transaction back, discarding all changes made within it.

This is equivalent to Transaction’s Drop implementation, but provides any error encountered to the caller.

Like Client::prepare.

Like Client::prepare_typed.

Like Client::execute.

Like Client::query.

Like Client::query_one.

Like Client::query_opt.

Like Client::query_raw.

Binds parameters to a statement, creating a “portal”.

Portals can be used with the query_portal method to page through the results of a query without being forced to consume them all immediately.

Portals are automatically closed when the transaction they were created in is closed.

Panics

Panics if the number of parameters provided does not match the number expected.

Continues execution of a portal, returning the next set of rows.

Unlike query, portals can be incrementally evaluated by limiting the number of rows returned in each call to query_portal. If the requested number is negative or 0, all remaining rows will be returned.

The maximally flexible version of query_portal.

Like Client::copy_in.

Like Client::copy_out.

Like Client::simple_query.

Like Client::batch_execute.

Like Client::cancel_token.

Like Client::transaction, but creates a nested transaction via a savepoint.

Like Client::transaction, but creates a nested transaction via a savepoint with the specified name.

Trait Implementations

Executes the destructor for this type. Read more

Like Client::execute.

Like Client::query.

Like Client::query_one.

Like Client::query_opt.

Like Client::query_raw.

Like Client::prepare.

Like Client::prepare_typed.

Like Client::copy_in.

Like Client::copy_out.

Like Client::simple_query.

Like Client::batch_execute.

Like Client::transaction.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more