Elixir learnings - 2020 Week 2
January 12, 2020
I learned that iex isn’t technically a true REPL 5.
I also got to take a deeper foray into application logging. I’ve been working on a more complex feature for work and would like to be able to track down any causes of bugs so
IO.inspect and the like aren’t going to be enough.
Latest release of elixir
A new release of elixir is in release candidate.
Calling into functions that can throw
Ran into this
== Compilation error in file lib/vs_integrations/petco/pgr/pet.ex == ** (CompileError) lib/vs_integrations/petco/pgr/pet.ex:11: cannot invoke remote function patient.client/0 inside guards (stdlib) lists.erl:1354: :lists.mapfoldl/3
def map_patient_to_pet(patient) when patient.client != nil do ...
You can write your own guards
Joining multiple tables
Real world reference projects
Running a single test in exunit
It’s possible to run a single test in exunit.
mix test /tests/path/to/test/some_test.ex:123
You can create tags for unit tests.
To spawn or not to spawn
Written by Blake Dietz who lives and works in Boise, ID and loves tinkering in his spare time. Follow him on twitter