It might be better to ask this on the https://elixirforum.com/ site.
Initially though, I'm curious what the quote'ing and such there is for, are these functions being used in a macro? Ecto queries are very changeable without macro's too. On Thursday, September 8, 2016 at 6:24:53 AM UTC-6, Vlad Alyukov wrote: > > Hi there, > > > When I try to make up a new hex (something like ransack in ruby land) I > have the next problem: > > > === > > defp match(%Rule{op: :eq, field: field, assoc: nil}, value, query) do > > quote do: unquote(query) |> where([q], q.unquote(field) == > ^unquote(var!(value))) > > end > > defp match(%Rule{op: :eq, field: field, assoc: assoc}, value, query) do > > quote do > > unquote(query) > > |> join(:inner, [r], l in assoc(r, unquote(var!(assoc)))) > > |> where([q], q.unquote(field) == ^unquote(var!(value))) > > end > > end > > === > > > first function works well, but when I try to pass "unquote(query)" > (regular "Ecto.Query" struct) to macros "join", I got an exception like > this: > > > === > > ** (CompileError) nofile: invalid quoted expression: #Ecto.Query<from > o in Order> > > === > > > Did I do something wrong? Why "where" and "join" macros have different > semantics? And, of course is there other way to build dynamic queries? > -- You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/aef453ae-ae54-4e66-9921-deeef3e7225f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.