123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354module juptune.postgres.client;
struct PostgresClient
{
/++ STRUCTS ++/
/// Intentionally public for documentation - PLEASE do not use this directly, only use .rowScanner
struct RowScanner(ReturnValues...)
{
/++ ALIASES ++/
///
alias Pointer(T) = T*;
///
alias ReturnValuePointers = ;
/++ FUNCTIONS ++/
/// Executes a query, and for each row it will scan the data into previously provided value set, calling onRow after each row has been scanned.
Result query(QueryArgs...)(const char[] query, QueryArgs args, Result function() onRow);
/// ditto.
Result queryGc(QueryArgs...)(const char[] query, QueryArgs args, Result function() onRow);
///
Result queryImpl(bool Once, HandlerT, QueryArgs...)(const char[] query, QueryArgs args, HandlerT onRow);
/// Functions mostly the same as query , with a few distinct changes.
Result queryRow(QueryArgs...)(const char[] query, QueryArgs args);
/++ VARIABLES ++/
///
ReturnValuePointers _pointers;
///
PostgresProtocol* _protocol;
}
/++ ALIASES ++/
///
alias __xdtor = __MARMOS_BUG__;
/++ FUNCTIONS ++/
/// Exactly the same as PostgresProtocol.connect
Result connect(IpAddress address, PostgresConnectInfo connectInfo);
/// Executes a query without reading in any of its returned rows.
Result exec(QueryArgs...)(const char[] query, QueryArgs args);
///
PostgresClient opAssign(PostgresClient p);
/// Returns: The underlying PostgresProtocol , for certain use cases this higher-level client doesn't provide.
PostgresProtocol protocol()scope ;
/// Constructs a row scanner that'll read any returned rows into the provided set of values.
rowScanner(ReturnValues...)(ReturnValues values);
}
A higher-level wrapper around PostgresProtocolthat makes it much easier to convert D types into their respective Postgres wire format, and vice-versa.
Most code should be using this instead of PostgresProtocol.
First, call .connectto connect and authenticate against a postgres instance.
If you want to execute a query without handling any return results, then use .execand .execGc.
If you want to execute a query and handle a single returned row, use .rowScanner().queryRow.
If you want to execute a query and handle multiple returned rows, use .rowScanner().queryand .rowScanner().queryGc.
If you want to execute multiple statements in one query, please use .protocolto access the underlying PostgresProtocol, and then call .simpleQueryon it.
| Name | Description |
|---|---|
| __xdtor |
| Name | Description |
|---|---|
| connect |
Exactly the same as |
| exec |
Executes a query without reading in any of its returned rows. |
| opAssign | |
| protocol |
Returns: The underlying |
| rowScanner |
Constructs a row scanner that'll read any returned rows into the provided set of values. |
| Name | Description |
|---|---|
| RowScanner |
Intentionally public for documentation - PLEASE do not use this directly, only use |