16 std::shared_ptr<PostgresClient>
client;
21 client->connect([
this, h](
bool s) {
43 std::shared_ptr<PostgresClient>
client;
46 std::vector<std::optional<std::string>>
params;
51 auto done = [
this, h](
const ResultSet& r) {
87 std::vector<std::optional<std::string>> params) {
110 std::vector<std::optional<std::string>> params = {}) {
111 return ResultAwaiter{[client = std::move(client), sql = std::move(sql), params = std::move(params)](
auto done) {
112 client->execute(sql, params, std::move(done));
128 return ResultAwaiter{[client = std::move(client)](
auto done) { client->begin(std::move(done)); },
ResultSet{}};
132 return ResultAwaiter{[client = std::move(client)](
auto done) { client->commit(std::move(done)); },
ResultSet{}};
136 return ResultAwaiter{[client = std::move(client)](
auto done) { client->rollback(std::move(done)); },
ResultSet{}};
Represents a generic, unified result set from a database query.
Definition ResultSet.hpp:197
Definition ConnectionPool.hpp:14
ConnectAwaiter connect_async(std::shared_ptr< PostgresClient > client)
Creates an awaiter for connecting a PostgresClient.
Definition PostgresCoro.hpp:35
ResultAwaiter execute_async(std::shared_ptr< PostgresClient > client, std::string sql, std::vector< std::optional< std::string > > params={})
Runs a statement through the prepared-statement cache (PostgresClient::execute).
Definition PostgresCoro.hpp:109
ResultAwaiter begin_async(std::shared_ptr< PostgresClient > client)
Transaction control for coroutines.
Definition PostgresCoro.hpp:127
ResultAwaiter commit_async(std::shared_ptr< PostgresClient > client)
Definition PostgresCoro.hpp:131
QueryAwaiter query_async(std::shared_ptr< PostgresClient > client, const std::string &sql)
Creates an awaiter for executing a query on a PostgresClient.
Definition PostgresCoro.hpp:75
ResultAwaiter rollback_async(std::shared_ptr< PostgresClient > client)
Definition PostgresCoro.hpp:135
A coroutine awaiter for connecting a PostgresClient asynchronously.
Definition PostgresCoro.hpp:15
bool await_resume()
Definition PostgresCoro.hpp:26
std::shared_ptr< PostgresClient > client
Definition PostgresCoro.hpp:16
void await_suspend(std::coroutine_handle<> h)
Definition PostgresCoro.hpp:20
bool await_ready() const noexcept
Definition PostgresCoro.hpp:19
bool success
Definition PostgresCoro.hpp:17
A coroutine awaiter for executing a query on a PostgresClient asynchronously.
Definition PostgresCoro.hpp:42
bool await_ready() const noexcept
Definition PostgresCoro.hpp:49
bool parameterized
Definition PostgresCoro.hpp:47
std::string sql
Definition PostgresCoro.hpp:44
std::shared_ptr< PostgresClient > client
Definition PostgresCoro.hpp:43
void await_suspend(std::coroutine_handle<> h)
Definition PostgresCoro.hpp:50
ResultSet await_resume()
Definition PostgresCoro.hpp:61
std::vector< std::optional< std::string > > params
Definition PostgresCoro.hpp:46
ResultSet result
Definition PostgresCoro.hpp:45
Awaits any PostgresClient operation that reports a ResultSet.
Definition PostgresCoro.hpp:94
void await_suspend(std::coroutine_handle<> h)
Definition PostgresCoro.hpp:99
ResultSet result
Definition PostgresCoro.hpp:96
bool await_ready() const noexcept
Definition PostgresCoro.hpp:98
ResultSet await_resume()
Definition PostgresCoro.hpp:105
std::function< void(std::function< void(const ResultSet &)>)> start
Definition PostgresCoro.hpp:95