Documentation
¶
Overview ¶
Example (GenObjectID) ¶
Checking that our IDs are pretty random...
rand.Seed(time.Now().UnixNano())
ids := map[string]bool{}
var g IDGen
for c := 0; c < 1000000; c++ {
id := g.GenObjectID()
_, exists := ids[id]
if exists {
fmt.Printf("match: %v\n", c)
break
}
ids[id] = true
}
fmt.Println("done")
Output: done
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDGen ¶
type IDGen struct {
}
IDGen - Implementation of ID generator interface
func (*IDGen) GenObjectID ¶
GenObjectID - Implementation of ID generator interface
type IDGenerator ¶
type IDGenerator interface {
GenObjectID() string
}
IDGenerator - Generates ID strings
type MockIDGenerator ¶
type MockIDGenerator struct {
IDs []string
}
Here we really just expose some test helpers
func (*MockIDGenerator) GenObjectID ¶
func (m *MockIDGenerator) GenObjectID() string
Click to show internal directories.
Click to hide internal directories.