Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 Ecto 查询非模型视图或表返回函数?在我的情况下,该函数(采用一个参数)返回与我的模型之一相同的列,并且只需要只读。
您可以告诉 Ecto 从任何视图或表中加载数据,如下所示:
from c in "special_comments(1)"
如果要将其加载到特定模块中,可以执行以下操作:
from c in {"special_comments(1)", MyApp.Comment}
你应该很高兴去!