예제 #1
0
func BenchmarkSnowflake(b *testing.B) {
	id := snowflake.New(0)
	b.ReportAllocs()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		id.Generate()
	}
}
예제 #2
0
func TestGenerateID(t *testing.T) {
	sf := snowflake.New(0)
	fmt.Println("snowflake:", sf.Generate())
	u1 := uuid.NewV1()
	fmt.Println("uuid1:", u1.Generate())
	u4 := uuid.NewV4()
	fmt.Println("uuid4:", u4.Generate())
	u1b64 := uuid.NewV1Base64()
	fmt.Println("uuid1 base64:", u1b64.Generate())
	un := uniuri.New()
	fmt.Println("uniuri:", un.Generate())
}