我在里面找到的
Module
's source
@doc """
Provides runtime information about functions and macros defined by the
module, etc.
Each module gets an `__info__/1` function when it's compiled. The function
takes one of the following atoms:
* `:functions` - keyword list of public functions along with their arities
* `:macros` - keyword list of public macros along with their arities
* `:module` - the module atom name
* `:md5` - the MD5 of the module
* `:compile` - a list with compiler metadata
* `:attributes` - a list with all persisted attributes
"""
def __info__(kind)
:deprecated
-显示模块中前缀为的弃用函数
@deprecated
属性(包含在
1.7.0-rc.0
)
尝试上述方法
behaviour =
凤凰城项目中的上述片段:
$ iex -S mix phx.server
iex(3)> Ecto.Adapters.Postgres.__info__(:attributes)
[
vsn: [168581197275628950002173003256895919063],
behaviour: [Ecto.Adapter],
behaviour: [Ecto.Adapter.Migration],
behaviour: [Ecto.Adapter.Queryable],
behaviour: [Ecto.Adapter.Schema],
behaviour: [Ecto.Adapter.Transaction],
behaviour: [Ecto.Adapter.Storage],
behaviour: [Ecto.Adapter.Structure]
]
iex(4)> for {:behaviour, behaviours} <-
...(4)> Ecto.Adapters.Postgres.__info__(:attributes),
...(4)> behaviour <- behaviours,
...(4)> do: behaviour
[Ecto.Adapter, Ecto.Adapter.Migration, Ecto.Adapter.Queryable,
Ecto.Adapter.Schema, Ecto.Adapter.Transaction, Ecto.Adapter.Storage,
Ecto.Adapter.Structure]