Generating unique ids in Mnesia
Joel Reymont
joelr1@REDACTED
Thu Aug 18 16:48:13 CEST 2005
Would I call mnesia:foldl() to figure out the maximum sequence number
and then create a new record with key seqnum + 1, all in the same
transaction?
On Aug 18, 2005, at 4:40 PM, Joel Reymont wrote:
> Folks,
>
> I need to maintain a table of players in Mnesia and I would like to
> assign players a unique id when they are added. Right now I
> generate a tuple of {timestamp hash, pid hash} and then hash that
> once more to get a unique id.
>
> Is there an easier way to do this in Mnesia? The ids can be
> sequential or random, they just can't repeat themselves as the
> table is a set. I guess I'm looking for something like a max
> aggregator on a Mnesia column.
More information about the erlang-questions
mailing list