1234567891011module juptune.postgres.client;
Result query(
QueryArgs...
)(
const char[] query,
QueryArgs args,
Result function(
) onRow
);
Executes a query, and for each row it will scan the data into previously provided value set, calling onRowafter each row has been scanned.
The following types are supported within the return value set. Unless specified, this is also the list of types that can be provided as query parameter arguments (via args).
ALL Postgres types can be converted into any of the supported D string types, even data types that are otherwise completely unsupported by Juptune.
Native D char slices (`const(char)[]` and string) are supported. The GC is used to perform a full copy of the data into these values.
Juptune's Stringtype is supported. This is the main @nogcalternative for strings. The value is still fully copied as with @gcstrings.
All native signed integers are supported and must correspond to the Postgres type with the same byte count. e.g. shortand SMALLINTis fine, intand SMALLINTisn't.
Notably byteisn't actually supported since Postgres lacks a one-byte integral type.
Unsigned types aren't supported as Postgres itself doesn't support unsigned integers.
bool
Duration(for TIME)
PostgresTimetz(for TIME WITH TIME ZONE)
PostgresDate(for DATE)
PostgresTimestamp(for TIMESTAMP)
PostgresTimestamptz(for TIMESTAMP WITH TIME ZONE)
Internally there's a templated function who's @nogc-ness is inferred by whether any of your return value set types requires the GC or not. e.g. If you use string s; rowScanner(s);, then you must** use queryGcinstead of query, as you'll otherwise get an error about @nogc.
PostgresClientError.columnCountMismatchif the amount of columns returned by the query is not exactly the same as the amount of values previously passed into the value set.
PostgresClientError.typeMismatchif one of the columns returned by the query is unable to be converted into its relative D type (e.g. the first column is a DATEbut the 0th value in the value set is a bool).
Anything that onRowthrows.
Anything that PostgresProtocol.prepare, and PostgresProtocol.bindDescribeExeccan.
An errorful Resultif something went wrong.