userver
C++ Async Framework
Toggle main menu visibility
Documentation
API Groups
Namespaces
Reference
Class List
Class Index
File List
Macros
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
database.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/postgres/database.hpp
4
/// @brief @copybrief storages::postgres::Database
5
6
#
include
<
vector
>
7
8
#
include
<
userver
/
storages
/
postgres
/
database_fwd
.
hpp
>
9
#
include
<
userver
/
storages
/
postgres
/
dsn
.
hpp
>
10
#
include
<
userver
/
storages
/
postgres
/
options
.
hpp
>
11
#
include
<
userver
/
storages
/
postgres
/
postgres_fwd
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
components
{
16
17
class
Postgres
;
18
19
}
// namespace components
20
21
namespace
storages::
postgres
{
22
23
/// Object for accessing PostgreSQL database instance (sharded or not)
24
class
Database
{
25
public
:
26
/// Cluster accessor for default shard number
27
ClusterPtr
GetCluster
()
const
;
28
29
/// Cluster accessor for specific shard number
30
ClusterPtr
GetClusterForShard
(size_t shard)
const
;
31
32
/// Get total shard count
33
size_t
GetShardCount
()
const
{
return
clusters_.size(); }
34
35
void
UpdateClusterDescription(
const
std::vector<DsnList>&);
36
37
private
:
38
friend
class
components
::
Postgres
;
39
std::vector<storages::
postgres
::ClusterPtr> clusters_;
40
};
24
class
Database
{
…
};
41
42
}
// namespace storages::postgres
43
44
USERVER_NAMESPACE_END
userver
storages
postgres
database.hpp
Generated on Thu Apr 24 2025 12:12:03 for userver by
Doxygen
1.13.2