Configure function default values

Sometimes it's really useful, or let's say even necessary, to configure your function-level default values per environment. Now, without any further ado, here is how you do it: @default_tty 1000 * 60 def something(ttl \\ default_ttl()) do # do something end # Time to live (ttl) period (in milliseconds). defp default_ttl do Application.get_env(:myapp, :some_topic, @default_ttl) … Continue reading Configure function default values

What is the difference between utc_datetime and naive_datetime in Ecto?

Regardless if you are new to Phoenix, Ecto or Elixir, at some point you might wonder what the two timestamp type options in your ecto schema are about. It also does not help much that the documentation on the differences between them is very minimal. It comes down to: :naive_datetime represent the NaiveDateTime Elixir type. … Continue reading What is the difference between utc_datetime and naive_datetime in Ecto?