|
relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
|
Namespaces | |
| namespace | sql_utils |
Classes | |
| class | AsyncStreamingResultSet |
| Async streaming result set that yields rows asynchronously. More... | |
| class | Connection |
| Abstract base class for database connections. More... | |
| struct | ConnectionError |
| Error type for database connection operations. More... | |
| struct | ConnectionPoolError |
| Error type for connection pool operations. More... | |
| struct | is_awaitable |
| Helper trait to detect if a type is boost::asio::awaitable. More... | |
| struct | is_awaitable< boost::asio::awaitable< T > > |
| class | PostgreSQLAsyncConnection |
| Asynchronous PostgreSQL implementation of the Connection interface. More... | |
| class | PostgreSQLAsyncStreamingSource |
| Async PostgreSQL streaming data source for processing large result sets. More... | |
| class | PostgreSQLConnection |
| PostgreSQL implementation of the Connection interface. More... | |
| struct | PostgreSQLConnectionParams |
| Basic parameters for a PostgreSQL connection. More... | |
| class | PostgreSQLConnectionPool |
| PostgreSQL connection pool that manages a collection of PostgreSQL connections. More... | |
| struct | PostgreSQLConnectionPoolConfig |
| Configuration for PostgreSQL connection pool. More... | |
| struct | PostgreSQLError |
| Specialized ConnectionError for PostgreSQL with detailed error information. More... | |
| class | PostgreSQLStatement |
| Represents a prepared statement in PostgreSQL. More... | |
| class | PostgreSQLStreamingSource |
| PostgreSQL streaming data source for processing large result sets. More... | |
| class | TransactionException |
| Exception thrown when transaction operations fail. More... | |
| class | TransactionGuard |
| RAII wrapper for database transactions. More... | |
Typedefs | |
| template<typename T > | |
| using | ConnectionResult = std::expected< T, ConnectionError > |
| Type alias for result of connection operations. | |
| template<typename T > | |
| using | ConnectionPoolResult = std::expected< T, ConnectionPoolError > |
| Type alias for result of connection pool operations. | |
Enumerations | |
| enum class | IsolationLevel { ReadUncommitted , ReadCommitted , RepeatableRead , Serializable } |
| Transaction isolation levels. More... | |
| enum class | PostgreSQLErrorCode { ConnectionFailed = 1000 , ConnectionClosed = 1001 , ConnectionTimeout = 1002 , TransactionError = 2000 , NoActiveTransaction = 2001 , TransactionAlreadyActive = 2002 , QueryFailed = 3000 , InvalidParameters = 3001 , EmptyResult = 3002 , DuplicateKey = 23505 , ForeignKeyViolation = 23503 , CheckConstraintViolation = 23514 , NotNullViolation = 23502 , Unknown = 9999 } |
| PostgreSQL specific error codes. More... | |
Functions | |
| template<typename T > | |
| void | convert_and_assign (T &target, const std::string &value) |
| Convert a string value to the target type and assign it. | |
| template<typename Tuple , size_t... Indices> | |
| void | apply_tuple_assignment (Tuple &tuple, const std::vector< std::string > &row, std::index_sequence< Indices... >) |
| Helper function to perform the tuple assignment with index sequence. | |
| template<typename Tuple > | |
| void | map_row_to_tuple (Tuple &tuple, const std::vector< std::string > &row) |
| Helper function to map a result row to a tuple (and thus to a struct) | |
| template<typename... Args> | |
| AsyncStreamingResultSet< PostgreSQLAsyncStreamingSource > | create_async_streaming_result (PostgreSQLAsyncConnection &connection, const std::string &sql, Args &&... args) |
| Create an async streaming result set from a PostgreSQL async connection and query. | |
| std::string | format_error (const ConnectionPoolError &error) |
| Format a ConnectionPoolError for exception messages. | |
| template<typename... Args> | |
| result::StreamingResultSet< PostgreSQLStreamingSource > | create_streaming_result (PostgreSQLConnection &connection, const std::string &sql, Args &&... args) |
| Create a streaming result set from a PostgreSQL connection and query. | |
Variables | |
| template<typename T > | |
| constexpr bool | is_awaitable_v = is_awaitable<T>::value |
| const std::unordered_map< std::string, PostgreSQLErrorCode > | sql_state_map |
| Map of SQL STATE codes to PostgreSQLErrorCode values. | |
| using relx::connection::ConnectionPoolResult = typedef std::expected<T, ConnectionPoolError> |
Type alias for result of connection pool operations.
Definition at line 55 of file postgresql_connection_pool.hpp.
| using relx::connection::ConnectionResult = typedef std::expected<T, ConnectionError> |
Type alias for result of connection operations.
Definition at line 29 of file connection.hpp.
|
strong |
Transaction isolation levels.
| Enumerator | |
|---|---|
| ReadUncommitted | Allows dirty reads. |
| ReadCommitted | Prevents dirty reads. |
| RepeatableRead | Prevents non-repeatable reads. |
| Serializable | Highest isolation level, prevents phantom reads. |
Definition at line 32 of file connection.hpp.
|
strong |
PostgreSQL specific error codes.
Definition at line 9 of file postgresql_errors.hpp.
| void relx::connection::apply_tuple_assignment | ( | Tuple & | tuple, |
| const std::vector< std::string > & | row, | ||
| std::index_sequence< Indices... > | |||
| ) |
| void relx::connection::convert_and_assign | ( | T & | target, |
| const std::string & | value | ||
| ) |
| AsyncStreamingResultSet< PostgreSQLAsyncStreamingSource > relx::connection::create_async_streaming_result | ( | PostgreSQLAsyncConnection & | connection, |
| const std::string & | sql, | ||
| Args &&... | args | ||
| ) |
Create an async streaming result set from a PostgreSQL async connection and query.
| connection | Async PostgreSQL connection to use |
| sql | SQL query to execute |
| params | Optional query parameters |
Definition at line 367 of file postgresql_async_streaming_source.hpp.
| result::StreamingResultSet< PostgreSQLStreamingSource > relx::connection::create_streaming_result | ( | PostgreSQLConnection & | connection, |
| const std::string & | sql, | ||
| Args &&... | args | ||
| ) |
Create a streaming result set from a PostgreSQL connection and query.
| connection | PostgreSQL connection to use |
| sql | SQL query to execute |
| params | Optional query parameters |
Definition at line 116 of file postgresql_streaming_source.hpp.
|
inline |
Format a ConnectionPoolError for exception messages.
Definition at line 49 of file postgresql_connection_pool.hpp.
| void relx::connection::map_row_to_tuple | ( | Tuple & | tuple, |
| const std::vector< std::string > & | row | ||
| ) |
|
inlineconstexpr |
Definition at line 28 of file postgresql_async_streaming_source.hpp.
|
inline |
Map of SQL STATE codes to PostgreSQLErrorCode values.
Definition at line 82 of file postgresql_errors.hpp.