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: ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.