github.com/koko1123/flow-go-1@v0.29.6/utils/unittest/generator/identifiers.go (about)

     1  package generator
     2  
     3  import "github.com/koko1123/flow-go-1/model/flow"
     4  
     5  type Identifiers struct {
     6  	count int
     7  }
     8  
     9  func IdentifierGenerator() *Identifiers {
    10  	return &Identifiers{1}
    11  }
    12  
    13  func newIdentifier(count int) flow.Identifier {
    14  	var id flow.Identifier
    15  	for i := range id {
    16  		id[i] = uint8(count)
    17  	}
    18  
    19  	return id
    20  }
    21  
    22  func (g *Identifiers) New() flow.Identifier {
    23  	id := newIdentifier(g.count + 1)
    24  	g.count++
    25  	return id
    26  }