I am trying to create unique int64 using the below golang code
unixtimestamp := time.Now().UnixNano()
node := AppConfig.NodeID << 44
timestamp := unixtimestamp << 12
var sequenceID int64
for sequenceID = 1; sequenceID <= count; sequenceID++ {
id := node | timestamp | sequenceID
idList = append(idList, id)
}
The above code is also generating negative numbers. How do I fix it?
Aucun commentaire:
Enregistrer un commentaire