Elixir Weekly Drip #4 and Exercise: More Queries [04.20.2017]
This week we learned the basics of Ecto. There's a ton more to cover, so I'll point you to some valuable resources in the links. After the links, you can find a detailed plan for this week's exercise, where we'll focus on more detailed queries for our data model.
Here are some links to provide further exploration of Ecto:
- What's new in Ecto 2.0 - an ebook from Plataformatec
- Here's someone's views on the best parts of that book
- Elixir School's Ecto Lesson
- Using Ecto Schemas with Database Views
- Using Ecto.Multi to Group Database Operations
- A couple of articles covering Ecto queries, written by Thomas Punt:
- A repo containing a ton of ecto query examples
For this week's exercise, we'll build on the existing data model. Write tests and then corresponding queries for the following:
- Given a category, find the three threads with the most recent posts.
- Given a user, find all of their posts.
- Given a user, find all of the threads in which they have posted.
- Given a thread, return the number of posts.
- Find all posts whose body contains a particular string.
You can use the dailydrip/firestorm repo after the previous episode as a starting point. See you soon!