I came up with this function:
def sequence_int(sequence_name, start \\ 0) do
Agent.get_and_update(ExMachina.Sequence, fn sequences ->
current_value = Map.get(sequences, sequence_name, start)
new_sequences = Map.put(sequences, sequence_name, current_value + 1)
{current_value, new_sequences}
end)
end
so I can do
def thing_factory
%{
foreign_id: sequence_int(:foreign_id, 100)
}
end
I don’t know if this would be a useful feature for others






















