relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
relx::connection::PostgreSQLAsyncStreamingSource Class Reference

Async PostgreSQL streaming data source for processing large result sets. More...

#include <relx/connection/postgresql_async_streaming_source.hpp>

Public Member Functions

 PostgreSQLAsyncStreamingSource (PostgreSQLAsyncConnection &connection, std::string sql, std::vector< std::string > params={})
 Constructor with async connection and query parameters.
 
 ~PostgreSQLAsyncStreamingSource ()
 Destructor that cleans up any active query.
 
 PostgreSQLAsyncStreamingSource (const PostgreSQLAsyncStreamingSource &)=delete
 
PostgreSQLAsyncStreamingSourceoperator= (const PostgreSQLAsyncStreamingSource &)=delete
 
 PostgreSQLAsyncStreamingSource (PostgreSQLAsyncStreamingSource &&other) noexcept
 
PostgreSQLAsyncStreamingSourceoperator= (PostgreSQLAsyncStreamingSource &&other) noexcept
 
boost::asio::awaitable< ConnectionResult< void > > initialize ()
 Initialize the streaming query asynchronously.
 
boost::asio::awaitable< std::optional< std::string > > get_next_row ()
 Get the next row from the result set asynchronously.
 
const std::vector< std::string > & get_column_names () const
 Get the column names for the result set.
 
bool is_initialized () const
 Check if the streaming source has been initialized.
 
bool has_more_rows () const
 Check if there are more rows available.
 
boost::asio::awaitable< void > async_cleanup ()
 Explicitly cleanup any active query asynchronously.
 
PostgreSQLAsyncConnectionget_connection ()
 Get reference to the underlying connection.
 

Detailed Description

Async PostgreSQL streaming data source for processing large result sets.

This class implements an async-compatible data source interface. It uses PostgreSQL's single-row mode with async operations to fetch results incrementally.

Definition at line 33 of file postgresql_async_streaming_source.hpp.

Constructor & Destructor Documentation

◆ PostgreSQLAsyncStreamingSource() [1/3]

relx::connection::PostgreSQLAsyncStreamingSource::PostgreSQLAsyncStreamingSource ( PostgreSQLAsyncConnection connection,
std::string  sql,
std::vector< std::string >  params = {} 
)

Constructor with async connection and query parameters.

Parameters
connectionAsync PostgreSQL connection to use for queries
sqlThe SQL query string to execute
paramsOptional query parameters

◆ ~PostgreSQLAsyncStreamingSource()

relx::connection::PostgreSQLAsyncStreamingSource::~PostgreSQLAsyncStreamingSource ( )

Destructor that cleans up any active query.

◆ PostgreSQLAsyncStreamingSource() [2/3]

relx::connection::PostgreSQLAsyncStreamingSource::PostgreSQLAsyncStreamingSource ( const PostgreSQLAsyncStreamingSource )
delete

◆ PostgreSQLAsyncStreamingSource() [3/3]

relx::connection::PostgreSQLAsyncStreamingSource::PostgreSQLAsyncStreamingSource ( PostgreSQLAsyncStreamingSource &&  other)
noexcept

Member Function Documentation

◆ async_cleanup()

boost::asio::awaitable< void > relx::connection::PostgreSQLAsyncStreamingSource::async_cleanup ( )

Explicitly cleanup any active query asynchronously.

Returns
Awaitable that resolves when cleanup is complete

◆ get_column_names()

const std::vector< std::string > & relx::connection::PostgreSQLAsyncStreamingSource::get_column_names ( ) const

Get the column names for the result set.

Returns
Vector of column names

◆ get_connection()

PostgreSQLAsyncConnection & relx::connection::PostgreSQLAsyncStreamingSource::get_connection ( )
inline

Get reference to the underlying connection.

Returns
Reference to the PostgreSQL async connection

Definition at line 80 of file postgresql_async_streaming_source.hpp.

◆ get_next_row()

boost::asio::awaitable< std::optional< std::string > > relx::connection::PostgreSQLAsyncStreamingSource::get_next_row ( )

Get the next row from the result set asynchronously.

Returns
Awaitable that resolves to optional string containing the next row data

Returns row data in the format "col1|col2|col3|..." for compatibility with LazyRow

◆ has_more_rows()

bool relx::connection::PostgreSQLAsyncStreamingSource::has_more_rows ( ) const
inline

Check if there are more rows available.

Returns
True if more rows are available, false if end of results or error

Definition at line 72 of file postgresql_async_streaming_source.hpp.

◆ initialize()

boost::asio::awaitable< ConnectionResult< void > > relx::connection::PostgreSQLAsyncStreamingSource::initialize ( )

Initialize the streaming query asynchronously.

Returns
Awaitable that resolves to success or failure

◆ is_initialized()

bool relx::connection::PostgreSQLAsyncStreamingSource::is_initialized ( ) const
inline

Check if the streaming source has been initialized.

Returns
True if initialized, false otherwise

Definition at line 68 of file postgresql_async_streaming_source.hpp.

◆ operator=() [1/2]

PostgreSQLAsyncStreamingSource & relx::connection::PostgreSQLAsyncStreamingSource::operator= ( const PostgreSQLAsyncStreamingSource )
delete

◆ operator=() [2/2]

PostgreSQLAsyncStreamingSource & relx::connection::PostgreSQLAsyncStreamingSource::operator= ( PostgreSQLAsyncStreamingSource &&  other)
noexcept

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