标签: postgresql elixir ecto
如何使用Ecto查询非模型视图或表返回函数?在我的例子中,函数(带一个参数)返回与我的一个模型相同的列,只需要只读。
答案 0 :(得分:2)
您可以告诉Ecto从任何视图或表格加载数据,如下所示:
from c in "special_comments(1)"
如果要将其加载到特定模块中,可以执行以下操作:
from c in {"special_comments(1)", MyApp.Comment}
你应该好好去!