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

Commit 2fe11da

Browse files
authored
Merge pull request #63 from mmmries/deps_and_typespecs
Deps and typespecs
2 parents 2380496 + d512d78 commit 2fe11da

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

config/config.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
# and its dependencies with the aid of the Mix.Config module.
33
use Mix.Config
44

5-
config :excheck, :number_iterations, 100
5+
if Mix.env == :test do
6+
config :excheck, :number_iterations, 100
7+
end

lib/sqlitex.ex

Lines changed: 2 additions & 3 deletions
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

@@ -31,8 +31,7 @@ defmodule Sqlitex do
3131
:esqlite3.close(db)
3232
end
3333

34-
@spec open(String.t) :: {:ok, connection}
35-
@spec open(charlist) :: {:ok, connection} | {:error, {atom, charlist}}
34+
@spec open(charlist | String.t) :: {:ok, connection} | {:error, {atom, charlist}}
3635
def open(path) when is_binary(path), do: open(string_to_charlist(path))
3736
def open(path) do
3837
:esqlite3.open(path)

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, [{atom, term}]) :: {: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 ->

mix.exs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ defmodule Sqlitex.Mixfile do
3030
{:decimal, "~> 1.1"},
3131

3232
{:credo, "~> 0.4", only: :dev},
33-
{:dialyze, "~> 0.2.0", only: :dev},
34-
{:earmark, "1.0.3", only: :dev},
35-
# v1.1 introduces a deprecation warning that causes a lot of console
36-
# noise when used with current as-of-this-writing version of exdoc (0.14.5)
33+
{:dialyxir, "~> 0.5.1", only: :dev, runtime: false},
34+
{:earmark, "~> 1.2", only: :dev},
3735
{:excoveralls, "~> 0.6", only: :test},
38-
{:ex_doc, "~> 0.14.5", only: :dev},
36+
{:ex_doc, "~> 0.18", only: :dev},
3937
{:inch_ex, "~> 0.5", only: :dev},
4038

4139
{:excheck, "~> 0.5", only: :test},

0 commit comments

Comments
 (0)