To be honest, I have a really hard time to understand why this library is using 
macros at all.
All of this can be achieved with just functions, in a much clearer way 
(although that’s obviously just my opinion).
Using functions also allows you to have multiple different builders, should you 
need them, and completely decouples the query from the module.

I’ve created a simple gist to showcase a possible, macro-less, solution: 
https://gist.github.com/michalmuskala/ade699c25caccb51760a4c0c050b5707 
<https://gist.github.com/michalmuskala/ade699c25caccb51760a4c0c050b5707>

Michał.

> On 16 Jul 2016, at 02:12, Brian Cardarella <[email protected]> wrote:
> 
> In one of my libraries this line throws a warning:
> 
> https://github.com/DockYard/inquisitor/blob/master/test/inquisitor_test.exs#L54
> 
> "unused import Ecto.Query"
> 
> because the `use` module above will @before_compile the following:
> 
> https://github.com/DockYard/inquisitor/blob/master/lib/inquisitor.ex#L83
> 
> so technically the Whitelist module has calls to Ecto.Query but for whatever 
> reason Elixir doesn't think so.
> 
> Yes, this is a test case but I'm curious if there are ways to clean this up?
> 
> --
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-talk/aa3b0d82-9a47-4296-ba64-47ca5f25271c%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-talk/aa3b0d82-9a47-4296-ba64-47ca5f25271c%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/B76B2989-8A0E-445E-B632-B51B19345C6B%40muskala.eu.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to