Vibe.d makes it easy to access databases in your backend services. MongoDB and Redis support come directly with vibe.d, other database adaptors can be found on code.dlang.org.
Access to MongoDB is modelled around the class
The implementation doesn't have external dependencies
and is implemented using vibe.d's asynchronous
sockets - no need to block if the connection
has some latency.
auto client = connectMongoDB("127.0.0.1"); auto users = client.getCollection("users"); users.insert(Bson("peter"));
Redis support is implemented with vibe.d sockets as well
and doesn't have external dependencies. Central
to the implementation is the
class which allows to run commands against a Redis
server. There are also convenience wrappers available, like
which allows to transparently access a list
stored in Redis.
MySQL support without external dependencies to the official MySQL library can be added using the mysql-native project. It supports vibe.d non-blocking sockets too.
A full-featured Postgresql client is implemented with the external module dpq2 that is based on the official libpq library. It uses vibe.d's event system to implement asynchronous behaviour.
Another alternative for Postgresql is ddb which implements a Postgresql client with vibe.d sockets and no external dependencies.