1..10
|> Task.async_stream(fn x -> x*2 end, max_concurrency: 2, timeout: 7000, on_timeout: :kill_task)
|> Enum.to_list()
Equivalent Go code would be very long and very ugly. defmodule MyApp.User do
...
def changeset(user, attrs) do
user
|> cast(attrs, [:email])
|> validate_required([:email])
# This matches the error from the DB uniq index to the :email field
|> unique_constraint(:email)
end
it could be RAM-bound, which is very much NOT cheap nowadays :)