O'Reilly logo

Programming Phoenix by Jose Valim, Bruce Tate, Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Wrapping Up

In this chapter, we pushed Ecto a little harder. We started with queries and went deep into the query API. We explored constraints and how Ecto integrates with the database, ensuring that our data is kept clean and consistent. We also built a category layer. Along the way, you learned many things about the Phoenix philosophy:

  • We used Ecto’s query API, which is independent of the repository API, to do some basic queries.

  • We used two forms of queries, a keyword list–based syntax and a pipe-based syntax.

  • We used fragments to pass SQL commands through the query API unchanged.

  • We explored the different ways Ecto queries work with relationships, beyond data preloading.

  • We wrote constraint-style validations for unique indexes and foreign-key ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required