vibe-d-postgresql ~fix_resetStart
PostgreSQL support for Vibe.d
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
PostgreSQL support for Vibe.d
Please help us to make documentation better!
Example:
module vibe.db.postgresql.example;
import vibe.d;
import vibe.db.postgresql;
PostgresClient client;
void test()
{
auto conn = client.lockConnection();
scope(exit) destroy(conn);
try
{
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);
import core.memory;
GC.collect();
}
catch(ConnectionException e)
{
logWarn(e.msg);
conn.reset(); // may throw ConnectionException too!
}
catch(Exception e)
{
logWarn(e.msg);
}
}
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"
- Registered by Denis Feklushkin
- ~fix_resetStart released 5 years ago
- denizzzka/vibe.d.db.postgresql
- MIT
- Copyright © 2016
- Authors:
- Sub packages:
- vibe-d-postgresql:example
- Dependencies:
- dpq2, vibe-d:core
- Versions:
-
3.1.3 2023-Apr-13 3.1.2 2022-Dec-06 3.1.1 2022-Aug-23 3.1.0 2022-May-25 3.1.0-rc.1 2020-Sep-07 - Download Stats:
-
-
8 downloads today
-
82 downloads this week
-
387 downloads this month
-
54883 downloads total
-
- Score:
- 4.1
- Short URL:
- vibe-d-postgresql.dub.pm