userver: storages::postgres::ConnectionSettings Struct Reference
Loading...
Searching...
No Matches
storages::postgres::ConnectionSettings Struct Reference

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

Detailed Description

PostgreSQL connection options

Dynamic option POSTGRES_CONNECTION_SETTINGS

Definition at line 196 of file options.hpp.

Public Types

enum  PreparedStatementOptions {
  kCachePreparedStatements ,
  kNoPreparedStatements
}
 
enum  UserTypesOptions {
  kUserTypesEnabled ,
  kUserTypesEnforced ,
  kPredefinedTypesOnly
}
 
enum  CheckQueryParamsOptions {
  kIgnoreUnused ,
  kCheckUnused
}
 
enum  DiscardOnConnectOptions {
  kDiscardNone ,
  kDiscardAll
}
 
using SettingsVersion = std::size_t
 

Public Member Functions

bool operator== (const ConnectionSettings &rhs) const
 
bool operator!= (const ConnectionSettings &rhs) const
 
bool RequiresConnectionReset (const ConnectionSettings &rhs) const
 

Public Attributes

PreparedStatementOptions prepared_statements = kCachePreparedStatements
 Cache prepared statements or not.
 
UserTypesOptions user_types = kUserTypesEnabled
 Enables the usage of user-defined types.
 
CheckQueryParamsOptions ignore_unused_query_params = kCheckUnused
 Checks for not-NULL query params that are not used in query.
 
std::size_t max_prepared_cache_size = kDefaultMaxPreparedCacheSize
 Limits the size or prepared statements cache.
 
PipelineMode pipeline_mode = PipelineMode::kDisabled
 Turns on connection pipeline mode.
 
OmitDescribeInExecuteMode omit_describe_mode = OmitDescribeInExecuteMode::kDisabled
 Enables protocol-level optimization when executing prepared statements.
 
std::size_t recent_errors_threshold = 2
 This many connection errors in 15 seconds block new connections opening.
 
std::optional< std::chrono::seconds > max_ttl {}
 The maximum lifetime of the connection after which it will be closed.
 
DiscardOnConnectOptions discard_on_connect = kDiscardAll
 Execute discard all after establishing a new connection.
 
SettingsVersion version {0U}
 Helps keep track of the changes in settings.
 

Member Typedef Documentation

◆ SettingsVersion

using storages::postgres::ConnectionSettings::SettingsVersion = std::size_t

Definition at line 214 of file options.hpp.

Member Enumeration Documentation

◆ CheckQueryParamsOptions

enum storages::postgres::ConnectionSettings::CheckQueryParamsOptions

Definition at line 206 of file options.hpp.

◆ DiscardOnConnectOptions

enum storages::postgres::ConnectionSettings::DiscardOnConnectOptions

Definition at line 210 of file options.hpp.

◆ PreparedStatementOptions

enum storages::postgres::ConnectionSettings::PreparedStatementOptions

Definition at line 197 of file options.hpp.

◆ UserTypesOptions

enum storages::postgres::ConnectionSettings::UserTypesOptions

Definition at line 201 of file options.hpp.

Member Function Documentation

◆ operator!=()

bool storages::postgres::ConnectionSettings::operator!= ( const ConnectionSettings & rhs) const
inline

Definition at line 250 of file options.hpp.

◆ operator==()

bool storages::postgres::ConnectionSettings::operator== ( const ConnectionSettings & rhs) const
inline

Definition at line 246 of file options.hpp.

◆ RequiresConnectionReset()

bool storages::postgres::ConnectionSettings::RequiresConnectionReset ( const ConnectionSettings & rhs) const
inline

Definition at line 252 of file options.hpp.

Member Data Documentation

◆ discard_on_connect

DiscardOnConnectOptions storages::postgres::ConnectionSettings::discard_on_connect = kDiscardAll

Execute discard all after establishing a new connection.

Definition at line 241 of file options.hpp.

◆ ignore_unused_query_params

CheckQueryParamsOptions storages::postgres::ConnectionSettings::ignore_unused_query_params = kCheckUnused

Checks for not-NULL query params that are not used in query.

Definition at line 223 of file options.hpp.

◆ max_prepared_cache_size

std::size_t storages::postgres::ConnectionSettings::max_prepared_cache_size = kDefaultMaxPreparedCacheSize

Limits the size or prepared statements cache.

Definition at line 226 of file options.hpp.

◆ max_ttl

std::optional<std::chrono::seconds> storages::postgres::ConnectionSettings::max_ttl {}

The maximum lifetime of the connection after which it will be closed.

Definition at line 238 of file options.hpp.

◆ omit_describe_mode

OmitDescribeInExecuteMode storages::postgres::ConnectionSettings::omit_describe_mode = OmitDescribeInExecuteMode::kDisabled

Enables protocol-level optimization when executing prepared statements.

Definition at line 232 of file options.hpp.

◆ pipeline_mode

PipelineMode storages::postgres::ConnectionSettings::pipeline_mode = PipelineMode::kDisabled

Turns on connection pipeline mode.

Definition at line 229 of file options.hpp.

◆ prepared_statements

PreparedStatementOptions storages::postgres::ConnectionSettings::prepared_statements = kCachePreparedStatements

Cache prepared statements or not.

Definition at line 217 of file options.hpp.

◆ recent_errors_threshold

std::size_t storages::postgres::ConnectionSettings::recent_errors_threshold = 2

This many connection errors in 15 seconds block new connections opening.

Definition at line 235 of file options.hpp.

◆ user_types

UserTypesOptions storages::postgres::ConnectionSettings::user_types = kUserTypesEnabled

Enables the usage of user-defined types.

Definition at line 220 of file options.hpp.

◆ version

SettingsVersion storages::postgres::ConnectionSettings::version {0U}

Helps keep track of the changes in settings.

Definition at line 244 of file options.hpp.


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