I have an Ecto model that I want to be stored in the database with a custom binary_id generated from an elixir function. Is this possible?
My id function looks like this:
def gen_id
String.upcase to_string Enum.take_random('abcdefghjkmnpqrstuvwxyz123456789', 8)
end
My schema looks like this:
schema "orders" do
belongs_to :type, Invoicer.Customer
@primary_key {:id, :binary_id, autogenerate: true}
field :order_details, :string
timestamps()
end