The Repository Pattern
Learn about the repository pattern.
Ecto’s approach to database access
Now that we’ve got the sample application up and running, we’re ready to begin our tour of Ecto. We’re going to start with the big picture and look at Ecto’s approach to database access. Ecto adopts the repository pattern to access the underlying data store. Once we understand this pattern, it’ll help make sense of Ecto’s overall architecture. Let’s take a quick look.
We’ll open a mix session in the music_db
application we set up in the last section, iex -S mix
. Then, type in the following lines of code:
- Insert a record
Get hands-on with 1400+ tech skills courses.