Skip to content

Commit

Permalink
Fix typespecs for Repo (#2597)
Browse files Browse the repository at this point in the history
Fixes typespecs and documentation for insert_all/3 and load/3
  • Loading branch information
moxley authored and josevalim committed Jun 19, 2018
1 parent 73e01a5 commit a5508eb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/ecto/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 532,7 @@ defmodule Ecto.Repo do
@doc """
Inserts all entries into the repository.
It expects a schema (`MyApp.User`) or a source (`"users"`) or
It expects a schema module (`MyApp.User`) or a source (`"users"`) or
both (`{"users", MyApp.User}`) as the first argument. The second
argument is a list of entries to be inserted, either as keyword
lists or as maps.
Expand All @@ -542,7 542,7 @@ defmodule Ecto.Repo do
does not support RETURNING in INSERT statements or no
return result was selected, the second element will be `nil`.
When a schema is given, the values given will be properly dumped
When a schema module is given, the entries given will be properly dumped
before being sent to the database. If the schema contains an
autogenerated ID field, it will be handled either at the adapter
or the storage layer. However any other autogenerated value, like
Expand All @@ -555,13 555,13 @@ defmodule Ecto.Repo do
It is also not possible to use `insert_all` to insert across multiple
tables, therefore associations are not supported.
If a source is given, without a schema, the given fields are passed
If a source is given, without a schema module, the given fields are passed
as is to the adapter.
## Options
* `:returning` - selects which fields to return. When `true`,
returns all fields in the given struct. May be a list of
returns all fields in the given schema. May be a list of
fields, where a struct is still returned but only with the
given fields. Or `false`, where nothing is returned (the default).
This option is not supported by all databases.
Expand Down Expand Up @@ -620,7 620,7 @@ defmodule Ecto.Repo do
by the UPDATE query.
"""
@callback insert_all(
schema_or_source :: binary | {binary, Ecto.Schema.t()} | Ecto.Schema.t(),
schema_or_source :: binary | {binary, module} | module,
entries :: [map | Keyword.t()],
opts :: Keyword.t()
) :: {integer, nil | [term]}
Expand Down Expand Up @@ -1078,7 1078,8 @@ defmodule Ecto.Repo do
@doc """
Loads `data` into a struct or a map.
The first argument can be a schema, or a map (of types) and determines the return value:
The first argument can be a a schema module, or a
map (of types) and determines the return value:
a struct or a map, respectively.
The second argument `data` specifies fields and values that are to be loaded.
Expand Down Expand Up @@ -1115,7 1116,7 @@ defmodule Ecto.Repo do
"""
@callback load(
struct_or_map :: Ecto.Schema.t() | map(),
module_or_map :: module | map(),
data :: map() | Keyword.t() | {list, list}
) :: Ecto.Schema.t() | map()
end

0 comments on commit a5508eb

Please sign in to comment.