Skip to content

Instantly share code, notes, and snippets.

@myobie
Created June 27, 2017 09:09
Show Gist options
  • Select an option

  • Save myobie/84e3cb70d828ab64ee78707dd6926197 to your computer and use it in GitHub Desktop.

Select an option

Save myobie/84e3cb70d828ab64ee78707dd6926197 to your computer and use it in GitHub Desktop.
How to use the todo.ex highlander object
id = UUID.uuid4()
{:ok, todo} = Todo.get id
assert todo.completed == false
assert todo.title == ""
assert todo.color == :blue
todo = %{todo | title: "Hello"}
{:ok, _} = Todo.put id, todo
# any amount of time later
{:ok, todo} = Todo.get id
assert todo.title == "Hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment