Search code examples
erlangorganizationrecordselixir

Elixir - Where to store record definitions?


What is the best practice as far as storing record definitions in Elixir? Should I separate each one out into it's own file and place them in the lib dir? Or is there a better way of organizing them? Another directory specifically for records?

Thanks in advance!


Solution

  • It depends. I would leave one per file if they are meant to be globally used. However, if you are simply using it to keep a gen server state or to be used in a single file, I would leave it in the file that uses it.