⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
userver
C++ Async Framework v2.0
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
dsn.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/postgres/dsn.hpp
4
/// @brief DSN manipulation helpers
5
6
#
include
<
string
>
7
#
include
<
vector
>
8
9
#
include
<
userver
/
clients
/
dns
/
resolver_fwd
.
hpp
>
10
#
include
<
userver
/
engine
/
deadline
.
hpp
>
11
#
include
<
userver
/
utils
/
strong_typedef
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
storages
::
postgres
{
16
17
using
Dsn
= USERVER_NAMESPACE::
utils
::
NonLoggable
<
class
DsnTag,
std
::
string
>;
18
using
DsnList
=
std
::
vector
<
Dsn
>;
19
20
DsnList SplitByHost(
const
Dsn& dsn);
21
22
/// Create a string `<user>@<host>:<port>/<dbname>` of a single-host DSN
23
/// or escape all the punctuation with _ for test
24
std::string
MakeDsnNick
(
const
Dsn& dsn,
bool
escape);
25
26
struct
DsnOptions
{
27
std::string host;
28
std::string port;
29
std::string dbname;
30
};
31
32
/// Read options from a DSN
33
/// First unique option is used if found, otherwise default is taken
34
DsnOptions
OptionsFromDsn
(
const
Dsn& dsn);
35
36
/// Return `<host>[:<port>]` string for a single-host DSN
37
std::string
GetHostPort
(
const
Dsn& dsn);
38
39
/// Return DSN string without 'password' field
40
std::string
DsnCutPassword
(
const
Dsn& dsn);
41
/// Return DSN string with password contents masked
42
std::string
DsnMaskPassword
(
const
Dsn& dsn);
43
44
std::string EscapeHostName(
const
std::string& hostname,
char
escape_char =
'_'
);
45
46
/// Return DSN string with hosts resolved as hostaddr values
47
/// If given DSN has no host or already contains hostaddr, does nothing
48
Dsn
ResolveDsnHostaddrs
(
const
Dsn
&
dsn
,
clients
::
dns
::
Resolver
&
resolver
,
49
engine
::
Deadline
deadline
);
50
51
}
// namespace storages::postgres
52
53
USERVER_NAMESPACE_END
Docs version:
v1.0
,
v2.0
,
trunk/develop
userver
storages
postgres
dsn.hpp
Generated on Wed May 15 2024 22:28:41 for userver by
Doxygen
1.10.0