vibe-d-postgresql 0.3.0-beta.1

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;

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);
}

static this()
{
    // params: conninfo string, maximum number of connections in
    // the connection pool
    client = new 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.3.0-beta.1 2017-Sep-06
0.2.23 2017-Jul-30
0.2.22 2017-May-03
0.2.21 2017-Mar-14
0.2.20 2016-Dec-16
Show all 30 versions
Download Stats:
  • 2 downloads today

  • 21 downloads this week

  • 293 downloads this month

  • 2202 downloads total