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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access