Last active
December 1, 2017 20:08
-
-
Save takuoka/e2193cb54c0038625018 to your computer and use it in GitHub Desktop.
Elixir の require, imoport, use ref: http://qiita.com/taku_oka/items/61178122e7bd52188af1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmacro __using__(_opts) do | |
quote do | |
use Ecto.Schema | |
import Ecto.Changeset | |
import Ecto.Query, only: [from: 2] | |
import Ecto.Model | |
use Ecto.Model.OptimisticLock | |
use Ecto.Model.Timestamps | |
use Ecto.Model.Dependent | |
use Ecto.Model.Autogenerate | |
use Ecto.Model.Callbacks | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require MyMacros |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex> import List | |
iex> flatten([1, [2], 3]) | |
[1,2,3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use HelloPhoenix.Web, :router |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use ExUnit.Case, async: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require ExUnit.Case | |
ExUnit.Case.__using__([async: true]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment