The Wire · Showcase
ECTO GAINS FRAGMENT COLUMN NAMING, PHOENIX PLUGS GET SMARTER
By RepoJournal · Filed · About Elixir & Phoenix
Ecto's new with_columns/2 lets you assign names to SQL fragments, while Phoenix now handles module plugs with options in pipe_through declarations.
Ecto shipped with_columns/2 [1], a cleaner way to name columns from fragment sources without cluttering from/join calls. This lands alongside the SQL companion PR [2], making it immediately useful for custom macros and complex queries. Over in Phoenix, module plugs with options in pipe_through now compile without errors [3]. Previously, writing pipe_through [:api, {MyPlug, greeting: "hey"}] would crash at compile time because build_pipes/2 didn't handle the tuple syntax. That's fixed. Phoenix also merged automated GitHub releases tied to changelog entries [4], matching a pattern they've already proven in LiveView. Finally, Range.disjoint?/2 got an 18% speed boost [5] by detecting empty ranges with direction comparisons instead of computing exact sizes.
One email a day. Unsubscribe in one click.
What actually shipped in Elixir & Phoenix, written up every day — commits, pull requests, releases, and security advisories.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Update Ecto and ecto_sql in tandem to use with_columns/2 for fragment queries elixir-ecto/ecto [plan]
- → Test your pipe_through declarations with {Plug, opts} tuples - they now work phoenixframework/phoenix [monitor]
- → Review any custom Range.disjoint?/2 calls - they're now faster with no code changes needed elixir-lang/elixir [monitor]
References
- [1] Add with_columns/2 to assign column names to fragment sources ↗ elixir-ecto/ecto
- [2] Add with_columns/2 to assign column names to fragment sources (#4759) elixir-ecto/ecto
- [3] Support module plugs with options in pipe_through ↗ phoenixframework/phoenix
- [4] Create GitHub releases with changelog ↗ phoenixframework/phoenix
- [5] Optimize Range.disjoint?/2 empty checks ↗ elixir-lang/elixir