Git Product home page Git Product logo

epgsql_pool's Introduction

Erlang PostgreSQL Connection Pool

* Application

  epgsql_pool will create any pools defined in the application's 'pools' environment
  parameter, which is a list of atoms. Each atom must refer to an environment parameter
  with the same name and value {Size, Opts} where Opts is a property list with the
  following supported options:

  host      - host to connect to, default "localhost".
  port      - port to connect to, default 5432.
  username  - username to authenticate with, default os:getenv("USER").
  password  - password to authenticate with, default "".
  database  - database to connect to, no default.

  .config file example:

    {epgsql_pool,  [{pools, [db1, db2]},
                    {db1, {10, [{database, "db1"}]}},
                    {db2, {10, [{database, "db2"}]}}]}                    
  
* Pool Usage

  {ok, C} = pgsql_pool:get_connection(Pool, Timeout).

  Pool          - Pid or Name of pool.
  Timeout       - Time, in milliseconds, to wait for a free connection.

  ok = pgsql_pool:return_connection(Pool, Connection).

* Details

  epgsql_pool monitors the process which called get_connection and returns the
  allocated connection to the pool if that process dies. If a connection dies,
  a new one is created and added to the pool in its place.

epgsql_pool's People

Contributors

lukyanov avatar uprial avatar

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.