Giter VIP home page Giter VIP logo

edbi's Introduction

EDBI - A database independent interface for Erlang

EDBI is intended as a database independence and connection pooling library for erlang programs.

Drivers

dummy
edbi_dummy A dummy driver for EDBI testing that just writes SASL logs on startup
pgsql
pgsql The Process One Postgresql driver modified for use with EDBI.
mysql
mysql The Process One MySQL driver modifed for use with EDBI. [1]
[1]Note that this driver isn't tested yet.

Installation

Build the source using rebar:

./rebar compile

Or use it as dependency in the rebar.config of your erlang application:

{deps, [
{edbi, "0.1.2",
{git, "git://github.com/bharendt/edbi.git", {tag, "v0.1.3"}}}

]}.

Configuration

EDBI uses OTP application configuration, so you can just put:

{edbi, [{pools, pools()}]}.

in your system.config file.

The syntax of the pools env value is described in edoc type format as follows:

pools() = [pool(),...].
pool()  = {PoolName::term(),
           Driver::atom(),
           Options::term(),
           Count::integer()}.
PoolName
the term used to identify and refer to the pool.
Driver
the name of the backend to use in the pool.
Options
a proplist of options to pass to the backend.
Count
the number of connections to maintain to the database.

Examples

A pool called dummy_pool of 10 dummy drivers.:

{dummy_pool, dummy, [], 10}

A pool (mydb) of 10 connections to the local postgres database mydb as myuser.:

{mydb, pgsql, [{database, "mydb"},
               {host, "localhost"},
               {user, "myuser"},
               {password, ""}],
       10}

Use

Currently the API is extremely basic and only allows you to retreive connection PIDs to use with the driver backend.:

1> ConnectionPid = edbi:connection(PoolName),
1> pgsql:squery(ConnectionPid, "select 1").
{ok,[{"SELECT",[{"?column?",text,0,23,4,-1,0}],[["1"]]}]}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.