bencoppock
I write about the frustration that can occur when dealing with string and atom-based keys in maps and how to (safely) translate string-based map keys to atoms:
Trending in Blog Posts
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
A while back, I had to process millions of database updates in a legacy system that was already hitting its 64 GB RAM limit, so scaling t...
New
At the heart of every Phoenix application is the often “invisible” HTTP server layer.
For over a decade Cowboy has served the community ...
New
I recently figured out how to the the Rust hotpath profiling crate running in an elixir benchmark script (for profiling NIFs). I had some...
New
The Phoenix framework is notorious for its long term stability and dependability. Unlike most comparable projects, the Phoenix team activ...
New
I’ve published Part 3 of my Elixir distributed systems learning series.
This part explores process monitoring using the low-level primit...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
D4no0
Isn’t it easier to translate all keys to string, I don’t see any downsides for that as cast/4 casts required params.
derpycoder
Thanks for the writeup, learnt a lot. Ability to use when in anonymous function was enlightening.
I am learning Elixir, and thought I would give list comprehension a try:
I will never mixup the two, anything external will always be string, and hand written values will be atoms.
bencoppock
Makes sense to me!
Assuming you just want to translate the params to be atom-based (and you’re not directly creating a record with Ecto), are you thinking something like this…?
I imagine that working well if you have Ecto in the mix and don’t need to give feedback on invalid params.
gregvaughn
I would be looking at
Ecto.Changeset.apply_action/2to return either{:ok, struct}or{:error, changeset}which contains errors in the 2nd case. But it certainly depends on ecto (though not ecto_sql).bencoppock
I wasn’t writing this with Ecto in mind, but I usually do have Ecto in the mix, so I like that.
It also feels cleaner to use the return of the
apply_actionfunction (which can include validation errors) as opposed to directly relying on thechangesfield in the Changeset struct (even though I think the field is more or less considered “public”).