Recompilation speedup: Put custom guards in Web.Utils.Guards
User.Query uses a custom guard, not_empty_string/1
, which checks that a param is_binary()
and isn't ""
.
For some reason that guard was inside AdminAPI.Search, creating compile-time cycles. not_empty_string/1
is generic and reusable, so I moved it to a new module for holding site-wide guards, Web.Utils.Guards
.
Doing so gets rid of a cycle: https://www.diffchecker.com/8xepzWZE
Also, I rewrote not_empty_string/1
using defguard
(Elixir 1.6) instead of defmacro.
Edited by Alex Gleason