ryanwold.net

A civic-minded citizen seeking the singularity

An entry

Elixir Notes & Commands

Date: 2023-02-19
Status: release
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.