#include <userver/storages/postgres/options.hpp>
PostgreSQL transaction options.
A transaction can be started using all isolation levels and modes supported by PostgreSQL server as specified in it's documentation.
Default isolation level is READ COMMITTED, default mode is READ WRITE.
Transaction class provides constants Transaction::RW, Transaction::RO and Transaction::Deferrable for convenience.
Other variants can be created with TransactionOptions constructors that are constexpr.
Definition at line 52 of file options.hpp.
Public Types | |
enum | Mode { kReadWrite = 0 , kReadOnly = 1 , kDeferrable = 3 } |
Public Member Functions | |
constexpr | TransactionOptions (IsolationLevel lvl) |
constexpr | TransactionOptions (IsolationLevel lvl, Mode m) |
constexpr | TransactionOptions (Mode m) |
bool | IsReadOnly () const |
Static Public Member Functions | |
static constexpr TransactionOptions | Deferrable () |
Public Attributes | |
IsolationLevel | isolation_level = IsolationLevel::kReadCommitted |
Mode | mode = kReadWrite |
[Transaction modes]
Enumerator | |
---|---|
kDeferrable | Deferrable transaction is read only. |
Definition at line 54 of file options.hpp.
|
inlineexplicitconstexpr |
Definition at line 64 of file options.hpp.
|
inlineconstexpr |
Definition at line 66 of file options.hpp.
|
inlineexplicitconstexpr |
Definition at line 68 of file options.hpp.
|
inlinestaticconstexpr |
The deferrable property has effect only if the transaction is also serializable and read only
Definition at line 74 of file options.hpp.
|
inline |
Definition at line 70 of file options.hpp.
IsolationLevel storages::postgres::TransactionOptions::isolation_level = IsolationLevel::kReadCommitted |
[Transaction modes]
Definition at line 60 of file options.hpp.
Mode storages::postgres::TransactionOptions::mode = kReadWrite |
Definition at line 61 of file options.hpp.