Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ecto, você sabe o que é ?
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Amanda
August 06, 2016
Technology
4
240
Ecto, você sabe o que é ?
Palestra apresentada no encontro do ELUG-SP
Amanda
August 06, 2016
Tweet
Share
More Decks by Amanda
See All by Amanda
Lessons Learned From an Elixir OTP Project
amandasposito
2
95
Aprendizados de um projeto Elixir OTP
amandasposito
4
630
SOLID - Dependency inversion principle
amandasposito
0
89
Como concorrência funciona em Elixir?
amandasposito
1
230
Programação Funcional & Elixir
amandasposito
3
130
Novidades no Rails 5
amandasposito
0
100
Rails Engines & RSpec
amandasposito
0
230
Elixir e Phoenix
amandasposito
3
580
Elixir em 5 minutos
amandasposito
1
98
Other Decks in Technology
See All in Technology
Bref でサービスを運用している話
sgash708
0
200
出版記念イベントin大阪「書籍紹介&私がよく使うMCPサーバー3選と社内で安全に活用する方法」
kintotechdev
0
100
SaaSの操作主体は人間からAIへ - 経理AIエージェントが目指す深い自動化
nishihira
0
110
FastMCP OAuth Proxy with Cognito
hironobuiga
3
220
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
10
76k
Why we keep our community?
kawaguti
PRO
0
320
OPENLOGI Company Profile for engineer
hr01
1
61k
イベントで大活躍する電子ペーパー名札を作る(その2) 〜 M5PaperとM5PaperS3 〜 / IoTLT @ JLCPCB オープンハードカンファレンス
you
PRO
0
210
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
580
Phase01_AI座学_基礎
overflowinc
0
4.5k
DMBOKを使ってレバレジーズのデータマネジメントを評価した
leveragestech
0
440
Change Calendarで今はOK?を仕組みにする
tommy0124
1
130
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The Curious Case for Waylosing
cassininazir
0
280
The untapped power of vector embeddings
frankvandijk
2
1.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Skip the Path - Find Your Career Trail
mkilby
1
89
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
200
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
600
The Spectacular Lies of Maps
axbom
PRO
1
650
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
470
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Transcript
Ecto Você sabe o que é?
@amandasposito @amsposito @amandasposito
None
Agenda • O que é? • Seus benefícios; • Componentes;
• Novidades da última versão.
O que é?
“Ecto is a domain specific language for writing queries and
interacting with databases in Elixir.”
object-relational mapping
object-relational mapping
None
Inspiração
LINQ Language Integrated Query
Parte do .NET Framework - Nov/2007
C#
Ecto
None
Vantagens
Composição
Você pode continuar a usar uma query em outra parte
do codigo
None
Isso é possível por causa dos Protocols de Elixir
None
Protocols ?
"Elixir provides protocols as a mechanism for polymorphism." http://elixir-lang.org/getting-started/protocols.html http://blog.plataformatec.com.br/2014/09/writing-assertive-code-with-elixir/
None
Sobre dados
Evita SQL injection
Interpolação e Casting de dados
Valores externos e expressões em Elixir podem ser adicionados a
uma query com ^ http://elixir-lang.org/getting-started/pattern-matching.html#the-pin-operator
None
None
Type safety
name == 1 ** (Ecto.Query.TypeCheckError) the following expression does not
type check:
Componentes
• Repo • Schema • Changeset • Query
Nosso modelo de dados
None
Ecto.Repo
Repo.all(query) https://hexdocs.pm/ecto/Ecto.Repo.html
Repo.start_link()
Ecto.Schema
None
None
None
Ecto.Changeset
None
None
None
Ecto.Query
None
None
https://hexdocs.pm/ecto/Ecto.Query.html#preload
https://hexdocs.pm/ecto/Ecto.Query.html#preload
https://hexdocs.pm/ecto/Ecto.Query.html#join/5
https://hexdocs.pm/ecto/Ecto.Query.html#join/5
https://hexdocs.pm/ecto/Ecto.Query.html#join/5
https://hexdocs.pm/ecto/Ecto.Query.html#preload
https://hexdocs.pm/ecto/Ecto.Query.html#preload
Novidades da última versão
Model -> Schema
Insert_all *http://blog.plataformatec.com.br/2016/05/ectos-insert_all-and-schemaless-queries/
None
Relacionamentos many_to_many
Subqueries
Chaves compostas
Otimização em connection pooling *https://github.com/elixir-ecto/ecto/releases/tag/v2.0.0 *http://blog.plataformatec.com.br/2016/04/ecto-2-0-0-rc-is-out/
Testes concorrentes, mesmo dependendo do banco de dados
Falei de mais né? Falei de mais né?
Resumindo
É uma Lib para você poder interagir com o banco
de dados
Consegue escrever queries no banco de dados escrevendo código Elixir
Composição / SQL Injection / Type Safety
Repo / Schema / Changeset / Query
https://github.com/amandasposito/ecto_demo
Obrigada!
Referências • http://blog.plataformatec.com.br/2016/05/ectos-insert_all-and-schemaless-queries/ • http://blog.plataformatec.com.br/2016/04/ecto-2-0-0-rc-is-out/ • https://hexdocs.pm/ecto/Ecto.html • https://github.com/elixir-ecto/ecto/wiki/Ecto-Basics •
https://changelog.com/208/ • https://www.youtube.com/watch?v=SJRfujy9vLA&feature=youtu.be&t=18m38s • https://www.youtube.com/watch?v=snka1bAtZS0