On 2017-01-03 06:25, Adam Wilson wrote:

Ok. How would you design a database API for D?

I don't know. I think it's difficult to design something upfront without trying out different API's to see what's possible to implement in code.

Structs and functions, with or without templates. Could something like this work:

module db_interface;

version (Postgres)
    public import pg.db_interface;
else version (MySQL)
    public import mysql.db_interface;

static assert(isInterfaceImplemented, "The DB interface is not implemented");


--
/Jacob Carlborg

Reply via email to