lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Friends | List of all members
lintel::DatabaseConnectionEntry Class Reference

#include <DatabaseConnectionEntry.h>

Inheritance diagram for lintel::DatabaseConnectionEntry:
lintel::Entry

Public Member Functions

 DatabaseConnectionEntry (std::string_view component, std::string connection, std::string userName, std::string password, db::ConnectionType type, std::string name, int32_t port, std::string databaseName, bool isDefault, int32_t poolSize=-1, int32_t poolAcquireTimeoutMs=-1)
 
const std::string & getConnection () const
 
const std::string & getUserName () const
 
const std::string & getPassword () const
 
const db::ConnectionType & getType () const
 
const std::string & getName () const
 
constexpr int32_t getPort () const
 
const std::string & getDatabaseName () const
 
constexpr bool isDefault () const
 
constexpr int32_t getPoolSize () const
 
constexpr int32_t getPoolAcquireTimeoutMs () const
 
- Public Member Functions inherited from lintel::Entry
 Entry (std::string_view component)
 
constexpr std::string_view getConfigurationParserComponent () const
 

Static Public Attributes

static constexpr int32_t kDefaultPostgresPoolSize = 4
 
static constexpr int32_t kDefaultSqlitePoolSize = 1
 
static constexpr int32_t kDefaultPoolAcquireTimeoutMs = 5000
 

Friends

std::ostream & operator<< (std::ostream &os, const DatabaseConnectionEntry &entry)
 

Detailed Description

Configuration entry for a database connection

Constructor & Destructor Documentation

◆ DatabaseConnectionEntry()

lintel::DatabaseConnectionEntry::DatabaseConnectionEntry ( std::string_view  component,
std::string  connection,
std::string  userName,
std::string  password,
db::ConnectionType  type,
std::string  name,
int32_t  port,
std::string  databaseName,
bool  isDefault,
int32_t  poolSize = -1,
int32_t  poolAcquireTimeoutMs = -1 
)

Construct a database connection entry

Parameters
componentThe configuration component name
connectionThe connection string
userNameThe database user name
passwordThe database password
typeThe connection type
nameThe connection name
portThe connection port
databaseNameThe database name
isDefaultWhether this is the default connection
poolSizeMaximum pooled connections; a negative value selects the type default (PostgreSQL 4, SQLite 1), 0 disables pooling
poolAcquireTimeoutMsAcquire timeout in milliseconds; a negative value selects the default (5000)

Member Function Documentation

◆ getConnection()

const std::string & lintel::DatabaseConnectionEntry::getConnection ( ) const

Get the connection string

Returns
The connection string

◆ getDatabaseName()

const std::string & lintel::DatabaseConnectionEntry::getDatabaseName ( ) const

Get the database name

Returns
The database name

◆ getName()

const std::string & lintel::DatabaseConnectionEntry::getName ( ) const

Get the connection name

Returns
The name

◆ getPassword()

const std::string & lintel::DatabaseConnectionEntry::getPassword ( ) const

Get the database password

Returns
The password

◆ getPoolAcquireTimeoutMs()

constexpr int32_t lintel::DatabaseConnectionEntry::getPoolAcquireTimeoutMs ( ) const
inlineconstexpr

Get the pool acquire timeout

Returns
The acquire timeout in milliseconds

◆ getPoolSize()

constexpr int32_t lintel::DatabaseConnectionEntry::getPoolSize ( ) const
inlineconstexpr

Get the maximum number of pooled connections

Returns
The pool size; 0 disables pooling

◆ getPort()

constexpr int32_t lintel::DatabaseConnectionEntry::getPort ( ) const
inlineconstexpr

Get the connection port

Returns
The port number

◆ getType()

const db::ConnectionType & lintel::DatabaseConnectionEntry::getType ( ) const

Get the connection type

Returns
The connection type

◆ getUserName()

const std::string & lintel::DatabaseConnectionEntry::getUserName ( ) const

Get the database user name

Returns
The user name

◆ isDefault()

constexpr bool lintel::DatabaseConnectionEntry::isDefault ( ) const
inlineconstexpr

Check if this is the default connection

Returns
True if default

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const DatabaseConnectionEntry &  entry 
)
friend

Stream insertion operator for database connection entries

Parameters
osThe output stream
entryThe entry to output
Returns
The output stream

Member Data Documentation

◆ kDefaultPoolAcquireTimeoutMs

constexpr int32_t lintel::DatabaseConnectionEntry::kDefaultPoolAcquireTimeoutMs = 5000
staticconstexpr

Default wait time of a pool acquire, in milliseconds.

◆ kDefaultPostgresPoolSize

constexpr int32_t lintel::DatabaseConnectionEntry::kDefaultPostgresPoolSize = 4
staticconstexpr

Default pool size for PostgreSQL connections (parallel HTTP threads).

◆ kDefaultSqlitePoolSize

constexpr int32_t lintel::DatabaseConnectionEntry::kDefaultSqlitePoolSize = 1
staticconstexpr

Default pool size for SQLite connections (a single serialized connection).


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