Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions PostgresClient.RowScanner.query

1
2
3
4
5
6
7
8
9
10
11
module juptune.postgres.client;

Result query(
    QueryArgs...
)(
    const char[] query, 
    QueryArgs args, 
    Result function(
        
    ) onRow
);

Documentation

Executes a query, and for each row it will scan the data into previously provided value set, calling onRowafter each row has been scanned.

Types

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)

Inference

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.

Params

Throws

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.

Returns

An errorful Resultif something went wrong.