initial commit
This commit is contained in:
commit
6358d0754b
34 changed files with 82616 additions and 0 deletions
20
client/extra.go
Normal file
20
client/extra.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
type ExtraGenerator func() string
|
||||
|
||||
func UuidV4Generator() ExtraGenerator {
|
||||
return func() string {
|
||||
var uuid [16]byte
|
||||
rand.Read(uuid[:])
|
||||
|
||||
uuid[6] = (uuid[6] & 0x0f) | 0x40
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80
|
||||
|
||||
return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", uuid[:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue