我在嘗試使用Ecto.Query.from/2構建查詢時遇到了一個奇怪的錯誤。 請參閱下面的代碼:Ecto.Query.from/2的第二個參數
iex(24)> import Ecto.Query, only: [from: 2]
nil
iex(25)> from User, limit: 1 # valid
#Ecto.Query<from u in Jcb.User, limit: 1>
iex(26)> opts = [limit: 1]
[limit: 1]
iex(27)> Keyword.keyword? opts
true
iex(28)> from user, opts
** (ArgumentError) second argument to `from` must be a keyword list
(ecto) expanding macro: Ecto.Query.from/2
iex:28: (file)
我找到了源代碼here,但我不知道這是錯誤或不。請幫忙。
謝謝!