Releases: tessi/ecto_fragment_extras
v0.3.0 - A rename and support for inline fragments
With this release we add support for inline fragments in addition to named fragments. Since we have more than one fragment type, a rename of the package was due.
-
renamed library from
ecto_named_fragment
toecto_fragment_extras
because it contains a little more than just the named_fragment() macro now 👇 -
added inline fragments which allow inlining fragment params into the query string:
inline_fragment("coalesce(#{users.name}, #{^default_name})")
-
added
frag/1
andfrag/2
as a shorthand for inline and named fragments depending on the arity it is called with.
v0.2.0 - Query Interpolation as if it is a string
Change interpolation syntax to be similar to string interpolation
After a discussion with Ecto maintainers
- elixir-ecto/ecto#4239 (comment)
- https://elixirforum.com/t/how-to-pass-named-or-numbered-parameters-to-ectos-fragment/49525/5?u=tessi
- https://groups.google.com/g/elixir-ecto/c/gEqI9lE3HGE
it seems like this feature will not be part of Ecto proper. However, the discussion revealed
a better implementation of this library (thanks @bamorim !) by using string interpolation instead of atom-like names.
This gives:
- better syntax highlighting for param names within fragment query strings
- better compilation time (for usage of the macro as well as for this lib)
- less dependencies for this library