【发布时间】:2017-01-31 09:57:16
【问题描述】:
从这两个在模块中正确定义的宏
defmacro binary(key) do
quote do
[
fragment("some fragment", unquote(key)),
fragment("some fragment", unquote(key))
]
end
end
defmacro mapbin(key) do
quote do
%{
"1" => fragment("some fragment same as above", unquote(key)),
"2" => fragment("some fragment same as above", unquote(key))
}
end
end
这行得通
from u in Table, select: binary("key")
但不是这个
from u in Table, select: mapbin("key")
宏中的地图有什么问题?
消息是编译错误
%{"1" => fragment("", ""),...} 不是有效的查询表达式。
【问题讨论】: