Skip to content

Commit bbdcf0b

Browse files
Typespec fixes (#344)
* Fix Mix.EctoSQL.ensure_migrations_path/2 spec * Fix Ecto.Adapters.SQL.format_table/1 spec * Loosen Ecto.Adapters.SQL.query spec At least the Postgres and MyXQL adapters are building up queries as iolists
1 parent 3016a64 commit bbdcf0b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/ecto/adapters/sql.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ defmodule Ecto.Adapters.SQL do
359359
@doc """
360360
Same as `query/4` but raises on invalid queries.
361361
"""
362-
@spec query!(Ecto.Repo.t | Ecto.Adapter.adapter_meta, String.t, [term], Keyword.t) ::
362+
@spec query!(Ecto.Repo.t | Ecto.Adapter.adapter_meta, iodata, [term], Keyword.t) ::
363363
%{:rows => nil | [[term] | binary],
364364
:num_rows => non_neg_integer,
365365
optional(atom) => any}
@@ -398,7 +398,7 @@ defmodule Ecto.Adapters.SQL do
398398
{:ok, %{rows: [[42]], num_rows: 1}}
399399
400400
"""
401-
@spec query(pid() | Ecto.Repo.t | Ecto.Adapter.adapter_meta, String.t, [term], Keyword.t) ::
401+
@spec query(pid() | Ecto.Repo.t | Ecto.Adapter.adapter_meta, iodata, [term], Keyword.t) ::
402402
{:ok, %{:rows => nil | [[term] | binary],
403403
:num_rows => non_neg_integer,
404404
optional(atom) => any}}
@@ -454,7 +454,7 @@ defmodule Ecto.Adapters.SQL do
454454
# | My Post Title | 1 | NULL |
455455
# +---------------+---------+--------+
456456
@doc false
457-
@spec format_table(%{columns: [String.t] | nil, rows: [term()] | nil}) :: String.t
457+
@spec format_table(%{:columns => [String.t] | nil, :rows => [term()] | nil, optional(atom) => any()}) :: String.t
458458
def format_table(result)
459459

460460
def format_table(nil), do: ""

lib/mix/ecto_sql.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Mix.EctoSQL do
44
@doc """
55
Ensures the given repository's migrations paths exists on the file system.
66
"""
7-
@spec ensure_migrations_paths(Ecto.Repo.t, Keyword.t) :: String.t
7+
@spec ensure_migrations_paths(Ecto.Repo.t, Keyword.t) :: [String.t]
88
def ensure_migrations_paths(repo, opts) do
99
paths = Keyword.get_values(opts, :migrations_path)
1010
paths = if paths == [], do: [Path.join(source_repo_priv(repo), "migrations")], else: paths

0 commit comments

Comments
 (0)