Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit cccd3b6

Browse files
committed
update typespecs to fix dialyzer warnings
1 parent 4ff1169 commit cccd3b6

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/sqlitex.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Sqlitex do
33
@type charlist :: char_list
44
end
55

6-
@type connection :: {:connection, reference, String.t}
6+
@type connection :: {:connection, reference, binary()}
77
@type string_or_charlist :: String.t | charlist
88
@type sqlite_error :: {:error, {:sqlite_error, charlist}}
99

lib/sqlitex/query.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ defmodule Sqlitex.Query do
2525
@type charlist :: char_list
2626
end
2727

28-
@spec query(Sqlitex.connection, String.t | charlist) :: [[]] | Sqlitex.sqlite_error
29-
@spec query(Sqlitex.connection, String.t | charlist, [bind: [], into: Enum.t]) :: [Enum.t] | Sqlitex.sqlite_error
28+
@spec query(Sqlitex.connection, String.t | charlist) :: {:ok, [[]]} | {:error, term()}
29+
@spec query(Sqlitex.connection, String.t | charlist, keyword) :: {:ok, [[]]} | {:error, term()}
3030
def query(db, sql, opts \\ []) do
3131
with {:ok, stmt} <- Statement.prepare(db, sql),
3232
{:ok, stmt} <- Statement.bind_values(stmt, Keyword.get(opts, :bind, [])),
@@ -82,8 +82,8 @@ defmodule Sqlitex.Query do
8282
8383
Returns the results otherwise.
8484
"""
85-
@spec query_rows!(Sqlitex.connection, String.t | charlist) :: [[]]
86-
@spec query_rows!(Sqlitex.connection, String.t | charlist, [bind: []]) :: [Enum.t]
85+
@spec query_rows!(Sqlitex.connection, String.t | charlist) :: %{}
86+
@spec query_rows!(Sqlitex.connection, String.t | charlist, [bind: []]) :: %{}
8787
def query_rows!(db, sql, opts \\ []) do
8888
case query_rows(db, sql, opts) do
8989
{:error, reason} -> raise Sqlitex.QueryError, reason: reason

lib/sqlitex/statement.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ defmodule Sqlitex.Statement do
366366
{:ok, _} = db_exec(db, "RELEASE #{sp}")
367367
end
368368

369+
@spec db_exec(Sqlitex.connection, iodata()) :: {:ok, [tuple()]}
369370
defp db_exec(db, sql) do
370371
case :esqlite3.q(sql, db) do
371372
{:error, _} = error ->

0 commit comments

Comments
 (0)