I want to capture views per date, and create or increase the count on each hit. Elixir and Ecto makes this super easy and cool. Damn!
def track_view(book) do
Repo.insert(%View{book_id: book.id, date: Date.utc_today(), total_views: 1},
conflict_target: [:book_id, :date],
on_conflict: [inc: [total_views: 1]]
)
end