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 learned how to seed data and how to use the :on_conflict option to manage data conflicts.

  • 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 violations.

  • We learned how to choose between letting constraint errors go and when to report them to the user.

Next, you’ll learn how to test everything we’ve seen so far.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.125