userver: storages::postgres::TransactionOptions Struct Reference
No Matches
storages::postgres::TransactionOptions Struct Reference

#include <userver/storages/postgres/options.hpp>

Detailed Description

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.

// Read-write read committed transaction.

Transaction class provides constants Transaction::RW, Transaction::RO and Transaction::Deferrable for convenience.

Other variants can be created with TransactionOptions constructors that are constexpr.

See also

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

Member Enumeration Documentation

◆ Mode

[Transaction modes]


Deferrable transaction is read only.

Definition at line 54 of file options.hpp.

Constructor & Destructor Documentation

◆ TransactionOptions() [1/3]

constexpr storages::postgres::TransactionOptions::TransactionOptions ( IsolationLevel lvl)

Definition at line 64 of file options.hpp.

◆ TransactionOptions() [2/3]

constexpr storages::postgres::TransactionOptions::TransactionOptions ( IsolationLevel lvl,
Mode m )

Definition at line 66 of file options.hpp.

◆ TransactionOptions() [3/3]

constexpr storages::postgres::TransactionOptions::TransactionOptions ( Mode m)

Definition at line 68 of file options.hpp.

Member Function Documentation

◆ Deferrable()

static constexpr TransactionOptions storages::postgres::TransactionOptions::Deferrable ( )

The deferrable property has effect only if the transaction is also serializable and read only

Definition at line 74 of file options.hpp.

◆ IsReadOnly()

bool storages::postgres::TransactionOptions::IsReadOnly ( ) const

Definition at line 70 of file options.hpp.

Member Data Documentation

◆ isolation_level

IsolationLevel storages::postgres::TransactionOptions::isolation_level = IsolationLevel::kReadCommitted

[Transaction modes]

Definition at line 60 of file options.hpp.

◆ mode

Mode storages::postgres::TransactionOptions::mode = kReadWrite

Definition at line 61 of file options.hpp.

The documentation for this struct was generated from the following file: