Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Potion

livebooks/startup/potion.livemd

Potion

Ecto

alias Potion.Repo
alias Potion.Accounts.User
alias Potion.Accounts.UserToken

Query

import Ecto.Query

id = 1

query = from u in "users",
  join: ut in "users_tokens", on: u.id == ut.user_id,
  where: u.id == ^id,
  select: [u.email]

Repo.one(query)

Schema

query = from u in User, where: u.id == 1

Repo.one!(query)