Digests » 268
this week's favorite
With Ecto.Multi it’s easy for us to write elegant transactional database code. Getting to grips with how to perform more complex operations can be difficult to grok at first though.
We have been building a platform where using LiveView made a lot of sense, since we wanted some of our features to use an interface that could be updated in real-time. For example, we wanted administrators of the platform to be able to see, on a map, the sightings that the users of the app were reporting on certain places, as they happen. Let’s call it a live map.
This took a bit of experimentation so I thought I would share my findings.
Let's take a look into Ecto's implementation of PostgreSQL Upsert and how different types of primary keys could change the results of this command. Spoiler alert, you could be surprised by non expected returns, so bare with me.
Elixir gave me a different perspective to programming and I will be going to use it as much as possible in future projects. Links to my recommended learning resources are attached at the end of this post.