vibe-d-postgresql 0.2.22

PostgreSQL support for Vibe.d


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

PostgreSQL support for Vibe.d

Example:

module vibe.db.postgresql.example;

import vibe.d;
import vibe.db.postgresql;

shared PostgresClient client;

void test()
{
    auto conn = client.lockConnection();
    immutable result = conn.execStatement(
        "SELECT 123 as first_num, 567 as second_num, 'abc'::text as third_text "~
        "UNION ALL "~
        "SELECT 890, 233, 'fgh'::text as third_text",
        ValueFormat.BINARY
    );
    delete conn;

    assert(result[0]["second_num"].as!PGinteger == 567);
    assert(result[1]["third_text"].as!PGtext == "fgh");

    foreach (val; rangify(result[0]))
        logInfo("Found entry: %s", val.as!Bson.toJson);
}

shared static this()
{
    // params: conninfo string, number of simultaneous connections
    client = new shared PostgresClient("dbname=postgres user=postgres", 4);

    test();
}

Output:

Found entry: 123
Found entry: 567
Found entry: "abc"

Authors: Denis Feklushkin <denis.feklushkin@gmail.com>

Sub packages: vibe-d-postgresql:example

Dependencies: vibe-d:core, dpq2

Versions:
0.2.22 2017-May-03
0.2.21 2017-Mar-14
0.2.20 2016-Dec-16
0.2.19 2016-Apr-15
0.2.18 2016-Apr-06
Show all 29 versions
Stats:
  • 14 downloads today

  • 85 downloads this week

  • 231 downloads this month

  • 1514 downloads total