Skip to content

Commit 2af8d96

Browse files
author
Brujo Benavides
authored
Merge pull request #10 from inaka/ferigis.9.fix_epgsql_dep
[#9] fixes epgsql dependency
2 parents 8bfe99b + 84eeeb0 commit 2af8d96

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{deps, [
2525
{lager, "3.2.1"},
2626
{sumo_db, "0.6.0"},
27-
{epgsql, {git, "https://github.com/epgsql/epgsql.git", {tag, "2.0.0"}}}
27+
{epgsql, "3.2.0"}
2828
]}.
2929

3030
%% == Profiles ==

src/sumo_backend_pgsql.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ handle_call(get_connection, _From, State) ->
8484
, user := Username
8585
, pass := Password
8686
, opts := Opts} = State,
87-
{ok, Conn} = pgsql:connect(Host, Username, Password, Opts),
87+
{ok, Conn} = epgsql:connect(Host, Username, Password, Opts),
8888
{reply, Conn, State}.
8989

9090
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

src/sumo_store_pgsql.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-author("Juan Facorro <[email protected]>").
2222
-license("Apache License 2.0").
2323

24-
-include_lib("epgsql/include/pgsql.hrl").
24+
-include_lib("epgsql/include/epgsql.hrl").
2525

2626
-behavior(sumo_store).
2727

@@ -127,7 +127,7 @@ persist(Doc, #{conn := Conn} = State) ->
127127
end,
128128

129129
ProcessedValues = lists:map(ToNullFun, Values),
130-
case pgsql:equery(Conn, stringify(Sql), ProcessedValues) of
130+
case epgsql:equery(Conn, stringify(Sql), ProcessedValues) of
131131
{ok, _Count, _Columns, Rows} ->
132132
{LastId} = hd(Rows),
133133
NewDoc = sumo_internal:set_field(IdField, LastId, Doc),
@@ -153,7 +153,7 @@ delete_by(DocName, Conditions, #{conn := Conn} = State) ->
153153
lists:flatten(Clauses)
154154
],
155155

156-
case pgsql:equery(Conn, stringify(Sql), Values) of
156+
case epgsql:equery(Conn, stringify(Sql), Values) of
157157
{ok, Count} ->
158158
{ok, Count, State};
159159
{error, Error} ->
@@ -165,7 +165,7 @@ delete_by(DocName, Conditions, #{conn := Conn} = State) ->
165165
delete_all(DocName, #{conn := Conn} = State) ->
166166
Sql = ["DELETE FROM ", escape(DocName)],
167167

168-
case pgsql:equery(Conn, stringify(Sql), []) of
168+
case epgsql:equery(Conn, stringify(Sql), []) of
169169
{ok, Count} ->
170170
{ok, Count, State};
171171
{error, Error} ->
@@ -253,7 +253,7 @@ find_by(DocName, Conditions, SortFields, Limit, Offset, State) ->
253253
Limit -> Values ++ [Limit, Offset]
254254
end,
255255

256-
case pgsql:equery(Conn, stringify(Sql2), AllValues) of
256+
case epgsql:equery(Conn, stringify(Sql2), AllValues) of
257257
{ok, Columns, Rows} ->
258258
ColFun = fun(Col) -> binary_to_atom(Col#column.name, utf8) end,
259259
ColumnNames = lists:map(ColFun, Columns),
@@ -298,7 +298,7 @@ create_schema(Schema, #{conn := Conn} = State) ->
298298
BinDql = iolist_to_binary(Dql),
299299
StrDql = binary_to_list(BinDql),
300300

301-
case pgsql:squery(Conn, StrDql) of
301+
case epgsql:squery(Conn, StrDql) of
302302
{error, Error} -> {error, Error, State};
303303
{ok, [], []} -> {ok, State}
304304
end.

0 commit comments

Comments
 (0)