Back to Entries

Elixir Notes & Commands

Date: 2023-02-19
Tags: ruby elixir code

Assuming your Repo and User are aliased, this command returns a count of users:

Aliased, like:

NameOfProject.Repo

NameOfProject.Accounts.User

Returning a count of users:

Repo.aggregate(User, :count, :id)

This is the same as User.count in Ruby/Rails.