Is reuse of fragments possible?
In an example like this
def unpublished_by_title(title) do from p in Post, where: is_nil(p.published_at) and fragment("downcase(?)", p.title) == ^title end
It seems like it would be very convenient to be able to extract fragmentation into a separate function so that it can be reused in other places, for example:
def unpublished_by_title(title) do from p in Post, where: is_nil(p.published_at) and downcase(p.title) == ^title end def downcase(title) do fragment("downcase(?)", ^title) end
however, after trying a lot of different options, it doesn't seem to work because of macro extensions or anything like that. Any ideas?
source share