Giter Site home page Giter Site logo

vibe.d.db.postgresql's Introduction

PostgreSQL support for Vibe.d

API documentation

Please help us to make documentation better!

====

Example:

module vibe.db.postgresql.example;

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

PostgresClient client;

void test()
{
    client.pickConnection(
        (scope conn)
        {
            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
            );

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

    logInfo("Done!");
}

Output:

[main(----) INF] Found entry: 123
[main(----) INF] Found entry: 567
[main(----) INF] Found entry: "abc"
[main(----) INF] Done!

vibe.d.db.postgresql's People

Contributors

denizzzka avatar tchaloupka avatar boris-barboris avatar schveiguy avatar atilaneves avatar irpbc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.