userver: userver/storages/postgres/postgres.hpp Source File
Loading...
Searching...
No Matches
postgres.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/storages/postgres/postgres.hpp
4/// This file is mainly for documentation purposes and inclusion of all headers
5/// that are required for working with PostgreSQL userver component.
6
7#include <userver/storages/postgres/cluster.hpp>
8#include <userver/storages/postgres/component.hpp>
9#include <userver/storages/postgres/exceptions.hpp>
10#include <userver/storages/postgres/result_set.hpp>
11#include <userver/storages/postgres/transaction.hpp>
12
13/// @page pg_driver uPg Driver
14///
15/// **Quality:** @ref QUALITY_TIERS "Platinum Tier".
16///
17/// 🐙 **userver** provides access to PostgreSQL database servers via
18/// components::Postgres. The uPg driver is asynchronous, it suspends
19/// current coroutine for carrying out network I/O.
20///
21/// @section features Features
22/// - PostgreSQL cluster topology discovery;
23/// - Manual cluster sharding (access to shard clusters by index);
24/// - Connection pooling;
25/// - Queries are transparently converted to prepared statements to use less
26/// network on next execution, give the database more optimization freedom,
27/// avoid the need for parameters escaping as the latter are now send
28/// separately from the query;
29/// - Automatic PgaaS topology discovery;
30/// - Selecting query target (master/slave);
31/// - Connection failover;
32/// - Transaction support;
33/// - Variadic template query parameter passing;
34/// - Query result extraction to C++ types;
35/// - More effective binary protocol usage for communication rather than the
36/// libpq's text protocol;
37/// - Caching the low-level database (D)escribe responses to save about a half
38/// of network bandwidth on select statements that return multiple columns
39/// (compared to the libpq implementation);
40/// - Portals for effective background cache updates;
41/// - Queries pipelining to execute multiple queries in one network roundtrip
42/// (for example `begin + set transaction timeout + insert` result in one
43/// roundtrip);
44/// - Ability to manually control network roundtrips via
45/// storages::postgres::QueryQueue to gain maximum efficiency
46/// in case of multiple unrelated select statements;
47/// - Mapping PostgreSQL user types to C++ types;
48/// - Transaction error injection via pytest_userver.sql.RegisteredTrx;
49/// - LISTEN/NOTIFY support via storages::postgres::Cluster::Listen();
50/// - @ref scripts/docs/en/userver/deadline_propagation.md .
51///
52/// @section toc More information
53/// - For configuration see components::Postgres
54/// - For cluster topology see storages::postgres::Cluster
55/// - @ref pg_transactions
56/// - @ref pg_run_queries
57/// - @ref pg_process_results
58/// - @ref pg_types
59/// - @ref pg_user_types
60/// - @ref pg_errors
61/// - @ref pg_topology
62///
63/// ----------
64///
65/// @htmlonly <div class="bottom-nav"> @endhtmlonly
66/// ⇦ @ref scripts/docs/en/userver/lru_cache.md | @ref pg_transactions ⇨
67/// @htmlonly </div> @endhtmlonly
68
69USERVER_NAMESPACE_BEGIN
70
71namespace storages {
72/// @brief Top namespace for uPg driver
73///
74/// For more information see @ref pg_driver
75namespace postgres {
76/// @brief uPg input-output.
77///
78/// Namespace containing classes and functions for defining datatype
79/// input-output and specifying mapping between C++ and PostgreSQL types.
80namespace io {
81/// @brief uPg input-output traits.
82///
83/// Namespace with metafunctions detecting different type traits needed for
84/// PostgreSQL input-output operations
85namespace traits {} // namespace traits
86} // namespace io
87} // namespace postgres
88} // namespace storages
89
90USERVER_NAMESPACE_END