Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Elixir 为什么exto.Repo进程不需要“发送/接收”?_Elixir_Ecto - Fatal编程技术网

Elixir 为什么exto.Repo进程不需要“发送/接收”?

Elixir 为什么exto.Repo进程不需要“发送/接收”?,elixir,ecto,Elixir,Ecto,当使用EXTO进行数据库查询时,我们将使用类似于Users.Repo.get!(id),这当然有效,但为什么我不需要发送/接收来与用户进行通信。Repo过程?为什么我可以简单地称之为引用模块和函数名 Users是一个OTP应用程序,其中Users.Application将Users.Repo进程作为子进程加载到Users.Supervisor进程中 ... def start(_type, _args) do children = [ Users.Repo,

当使用EXTO进行数据库查询时,我们将使用类似于
Users.Repo.get!(id)
,这当然有效,但为什么我不需要
发送/接收
来与
用户进行通信。Repo
过程?为什么我可以简单地称之为引用模块和函数名

Users
是一个OTP应用程序,其中
Users.Application
Users.Repo
进程作为子进程加载到
Users.Supervisor
进程中

  ...

  def start(_type, _args) do
    children = [
      Users.Repo,
    ]
    opts = [strategy: :one_for_one, name: Users.Supervisor]
    Supervisor.start_link(children, opts)
  end

Users.Repo
get
exto.Repo
注入,因此默认的
get/3
实现是到,然后向下到


adapter
反过来已经是一个接口,
execute/5
是一个到后台调用的进程的接口。这个抽象级别是为您封装连接池、超时、错误处理等所必需的。

Users.Repo
gets
exto.Repo
注入,因此默认的
get/3
实现是to,然后是down to

adapter
反过来已经是一个接口,
execute/5
是一个到后台调用的进程的接口。这个抽象级别是为您封装连接池、超时、错误处理等所必需的