Skip to content

Commit

Permalink
Merge pull request wg#21 from urbanserj/typespecs
Browse files Browse the repository at this point in the history
More precise specs of functions
  • Loading branch information
davidw committed Jun 11, 2014
2 parents c7dfb06 + 67dcf6a commit f060df9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pgsql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ close(C) ->
get_parameter(C, Name) ->
pgsql_sock:get_parameter(C, Name).

-spec squery(connection(), string()) ->
ok_reply(squery_row()) | {error, query_error()}.
-spec squery(connection(), string() | iodata()) ->
ok_reply(squery_row()) | {error, query_error()} |
[ok_reply(squery_row()) | {error, query_error()}].
squery(C, Sql) ->
gen_server:call(C, {squery, Sql}, infinity).

Expand All @@ -107,7 +108,7 @@ equery(C, Sql, Parameters) ->
Error
end.

-spec equery(connection(), string(), string(), [bind_param()]) ->
-spec equery(connection(), string(), string() | iodata(), [bind_param()]) ->
ok_reply(equery_row()) | {error, query_error()}.
equery(C, Name, Sql, Parameters) ->
case parse(C, Name, Sql, []) of
Expand All @@ -126,7 +127,7 @@ parse(C, Sql) ->
parse(C, Sql, Types) ->
parse(C, "", Sql, Types).

-spec parse(connection(), iolist(), string(), [epgsql_type()]) ->
-spec parse(connection(), iolist(), string() | iodata(), [epgsql_type()]) ->
{ok, #statement{}} | {error, query_error()}.
parse(C, Name, Sql, Types) ->
sync_on_error(C, gen_server:call(C, {parse, Name, Sql, Types}, infinity)).
Expand Down Expand Up @@ -155,7 +156,8 @@ execute(C, S, N) ->
when
Reply :: {ok | partial, [equery_row()]}
| {ok, non_neg_integer()}
| {ok, non_neg_integer(), [equery_row()]}.
| {ok, non_neg_integer(), [equery_row()]}
| {error, query_error()}.
execute(C, S, PortalName, N) ->
gen_server:call(C, {execute, S, PortalName, N}, infinity).

Expand Down

0 comments on commit f060df9

Please sign in to comment.