sumo_db
This is a work in progress. There's also an article about sumo_db.
sumo_db aims to ease db access for erlang applications. It offers a very simple persistance layer capable of interacting with different db's, while offering a consistent api to your code.
- sumo_db gives you a standard way to define your db schema, no matter the db implementation (mongo, mysql, redis, or sqlite3).
- Your entities encapsulate behavior in code (functions in module) and state into proplists.
- sumo is the main module. It translates to and from #sumo_doc records into your own state.
- Each repo is a process sumo_repo that calls the actual db driver (e.g: sumo_repo_mysql).
- Some native domain events are supported, that are dispatched through a gen_event:notify/2 automatically when an entity is created, updated, deleted. Also when a schema is created and when all entities of a given type are deleted. Events are described in this article
In order to avoid having sumo_db require the db drivers (like emysql, emongo, etc), you should include them in your application. Currently, sumo_db has been tested with the following drivers and versions.
- redis (uses eredis)
- sqlite3 (uses erlang-sqlite3)
- mnesia
- memory
See: examples/blog for a full example. To run it, while being in the top level directory:
make all blog
- Get rid of atoms and use lists.