A simple go library for generation unique IDs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
265 B

package uniqueID
type ID int
type IDSpace struct {
freeID ID
func (s *IDSpace) NewID() ID {
newID := s.freeID
return newID
func (s *IDSpace) IDExists(id ID) bool {
//All IDs below freeID are taken and therefore exist
return s.freeID > id