Search⌘ K
AI Features

The Repo Module

Explore how to implement and use the Repo module in Ecto to perform core database operations like create, read, update, and delete. Understand the role of the use macro and otp_app option for configuring database connections in Elixir applications.

The heart of Ecto

Now that we’ve got a handle on what a repository is, let’s look at how it’s implemented in Ecto. The Repo module is the heart of Ecto, and just about everything we do will touch Repo somehow. The Repo module is also quite powerful. We can perform all of the classic CRUD operations (create, read, update, and delete) using just the Repo module. The other modules in Ecto make these operations easier, but there’s a lot we can do with Repo.

Repo’s functionality

Given its relationship to the repository ...