dpq 0.0.2

A postgresql (libpq, pq) library aiming to be simple to use

To use this package, run the following command in your project's root directory:

dpq - A D PostgreSQL library

dpq wraps the libpq library and aims to provide a simple and modern way to access PostgreSQL in the D programming language.

Current features:

  • Opening a connection using a connection string
  • Queries
  • Fetching the results of queries in binary format
  • Looping through the said results
  • Exceptions on query errors

## Planned features

  • Object-relational mapping
  • Automatic schema creating from objects
  • Connection pooling

## Documentation

There is no docs yet, in the future, they should be written into the source code itself.

Some notes:

  • If a wrong type is specified while fetching a column, the results are undefined. Most likely just garbage


MIT, read LICENSE.txt

Very simple example code

import std.stdio;
import dpq.connection;
import dpq.query;

void main()
	auto conn = Connection("host=somehost dbname=testdb user=testuser password='VerySecureTestPassword'");
	// One-line query execution, the same could be done with Connection.exec(string command)
	Query("CREATE TABLE IF NOT EXISTS test (id SERIAL, txt TEXT)").run();
	// Last connection will be used if none is specified as the first param to Query()
	q = Query("SELECT id, txt FROM test WHERE id = $1 OR id = $2");
	// Params could also be added with the << operator
	// r << 4 << 1;
	r = q.run(4, 1);
	foreach (row; r)
		writeln("row['txt'] is: ", row["txt"].as!string);

    // Connection does not have to be closed, the destructor will take care of that.

  • Irenej
0.11.0 2019-Nov-20
0.10.0 2019-Nov-20
0.9.3 2018-Jan-10
0.9.1 2017-Mar-25
0.9.0-alpha.1 2016-Aug-11
Show all 50 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 743 downloads total

Short URL: