Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support new Poolboy API

  • Loading branch information...
commit de5a3047f91e505aca2b374feda9eca5afd977c3 1 parent 2e23750
@devinus authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/epgsql_pool.erl
View
18 src/epgsql_pool.erl
@@ -1,17 +1,25 @@
-module(epgsql_pool).
--export([child_spec/2, squery/2, equery/3]).
+-export([child_spec/3, squery/2, equery/3]).
-child_spec(Name, Args) ->
- WorkerModule = {worker_module, epgsql_pool_worker},
- PoolArgs = lists:keystore(worker_module, 1, Args, WorkerModule),
- poolboy:child_spec(Name, PoolArgs).
+-spec child_spec(Name :: node(),
+ PoolArgs :: proplists:proplist(),
+ WorkerArgs :: proplists:proplist())
+ -> supervisor:child_spec().
+child_spec(Name, SizeArgs, WorkerArgs) ->
+ PoolArgs = lists:keystore(worker_module, 1, SizeArgs,
+ {worker_module, epgsql_pool_worker}),
+ poolboy:child_spec(Name, PoolArgs, WorkerArgs).
+-spec squery(PoolName :: node(), Sql :: string()) ->
+ term().
squery(PoolName, Sql) ->
poolboy:transaction(PoolName, fun(Worker) ->
epgsql_pool_worker:squery(Worker, Sql)
end).
+-spec equery(PoolName :: node(), Stmt :: string(), Params :: list()) ->
+ term().
equery(PoolName, Stmt, Params) ->
poolboy:transaction(PoolName, fun(Worker) ->
epgsql_pool_worker:equery(Worker, Stmt, Params)
Please sign in to comment.
Something went wrong with that request. Please try again.