来自模块中正确定义的这两个宏
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("", ""),...}
不是有效的查询表达式。