On this page
Mix.Ecto
Conveniences for writing Ecto related Mix tasks.
Summary
Functions
- ensure_implements(module, behaviour, message)
-
Returns
true
if module implements behaviour. - ensure_repo(repo, args)
-
Ensures the given module is an Ecto.Repo.
- no_umbrella!(task)
-
Gets a path relative to the application path.
- open?(file, line \\ 1)
-
Asks if the user wants to open a file based on ECTO_EDITOR.
- parse_repo(args)
-
Parses the repository option from the given command line args list.
Functions
ensure_implements(module, behaviour, message)Source
Returns true
if module implements behaviour.
ensure_repo(repo, args)Source
@spec ensure_repo(module(), list()) :: Ecto.Repo.t()
Ensures the given module is an Ecto.Repo.
no_umbrella!(task)Source
Gets a path relative to the application path.
Raises on umbrella application.
open?(file, line \\ 1)Source
@spec open?(binary(), non_neg_integer()) :: boolean()
Asks if the user wants to open a file based on ECTO_EDITOR.
By default, it attempts to open the file and line using the file:line
notation. For example, if your editor is called subl
, it will open the file as:
subl path/to/file:line
It is important that you choose an editor command that does not block nor that attempts to run an editor directly in the terminal. Command-line based editors likely need extra configuration so they open up the given file and line in a separate window.
Custom editors are supported by using the __FILE__
and __LINE__
notations, for example:
ECTO_EDITOR="my_editor +__LINE__ __FILE__"
and Elixir will properly interpolate values.
parse_repo(args)Source
@spec parse_repo([term()]) :: [Ecto.Repo.t()]
Parses the repository option from the given command line args list.
If no repo option is given, it is retrieved from the application environment.
© 2013 Plataformatec
© 2020 Dashbit
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/ecto/Mix.Ecto.html