Generator numar unic crescator
func idGenerator() chan int {
ids := make(chan int)
go func() {
id := 0 //intializare cu ultimul nr din baza de date
for {
id++
ch <- id
}
}()
return ids
}
ids := idGenerator()
id1 := <-ids
id2 := <-ids