Skip to Main Content
Mastering Elixir
book

Mastering Elixir

by André Albuquerque, Daniel Caixinha
July 2018
Intermediate to advanced content levelIntermediate to advanced
574 pages
14h 7m
English
Packt Publishing
Content preview from Mastering Elixir

Sample data

To execute a query, we need data. Let's create the ElixirDrip.Search.SampleData module to encapsulate all the methods responsible for data creation. We will start with the users/0 function, which returns a list with nine users, associating each user's id with their email:

$ cat examples/sample_data.exsdefmodule ElixirDrip.Search.SampleData do  @moduledoc false  def users do    [      %{id: 1, email: "andre_albuquerque@elixir.pt"},      %{id: 2, email: "daniel_caixinha@elixir.pt"},      %{id: 3, email: "jose_valim@elixir.br"},      %{id: 4, email: "joe_armstrong@erlang.uk"},      %{id: 5, email: "robert_virding@erlang.se"},      %{id: 6, email: "mike_williams@erlang.wls"},      %{id: 7, email: "jose_lusquinos@panda.pt"},      %{id: 8, email: "atenas@meow.cat"}, %{id: 9, email: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Testing Elixir

Testing Elixir

Andrea Leopardi, Jeffrey Matthias

Publisher Resources

ISBN: 9781788472678Supplemental Content