Тёмный

ElixirConf 2023 - Alexander Webb - fragment/1: Ecto.Query's underrated superweapon 

ElixirConf
Подписаться 12 тыс.
Просмотров 1,8 тыс.
50% 1

elixirforum.co...
2023.elixircon...
Ecto's query DSL is very nice and powerful, even without `fragment`. However, many extremely interesting corners of SQL query syntax are out of reach to the DSL. That's where `fragment` comes in.
I know, of course, that Ecto also supports SQLite and MySQL, but I have never used them professionally and won't touch on them here. All of the Ecto content should generalize, but I will show some advanced Postgres query features which won't.
In this talk, I will show:
- The basics of how a DSL query turns into SQL.
- How fluent and easy it is to use `fragment` when the DSL syntax isn't available.
- How there are powerful expansion-time safety features that make it much harder to misuse than you would think
- How to combine `fragment` with PG's JSON support and aggregates to write some cool and performant queries that unwrap deeply nested joins into flat queries returning nested JSON (which Ecto conveniently turns right into Elixir nested maps)
- How to safely wrap `fragment` in another macro to reduce duplication without making a SQL-injection vulnerability

Опубликовано:

 

5 ноя 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
Se las dejo ahí.
00:10
Просмотров 2,5 млн
Learn Elixir: OTP, GenServers, Agents, & Tasks
13:05
ElixirConf 2017 - Thinking In Ecto - Darin Wilson
35:25