← All series

Series contents

Log in to track your progress

  1. 1. Ecto Overview: The Repo Episode
  2. 2. Configuring a new project with Ecto Episode
  3. 3. Creating Ecto Migrations Episode
  4. 4. Schema-less Ecto Queries Episode
  5. 5. Our first Ecto schemas Episode
  6. 6. Some useful Ecto functions Episode
  7. 7. Configuring IEx for working with Ecto Episode
  8. 8. Ecto belongs_to and has_many Episode
  9. 9. Ecto many_to_many and joining through Episode
  10. 10. Naming things in an Ecto project Episode
  11. 11. Ecto changesets: change vs cast Episode
  12. 12. Ecto changesets, validations and constraints Episode
  13. 13. Ecto build_assoc and put_assoc Episode

Some useful Ecto functions

Part of the Ecto Beginner series. This goes over a quick recap of what we've covered and teaches more Repo functions we can use to query the DB.

raw SQL

Repo.query

executing a query directly

Repo.all
Repo.one

batch / schema-less actions

Repo.insert_all
Repo.update_all
Repo.delete_all

single queries (with schema, handle auto timestamps)

Repo.insert
Repo.update
Repo.delete

Some other very common queries

Repo.get
Repo.get! (and analogues like insert!, delete!)
Repo.get_by

Repo.aggregate (with :count, :avg, etc)
Repo.exist?

Open standalone page ↗

No Comments