github.com/songzhibin97/gkit@v1.2.13/generator/example_test.go (about)

     1  package generator
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  func ExampleNewSnowflake() {
     8  	// 生成对象
     9  	generate := NewSnowflake(time.Now(), 1)
    10  	nid, err := generate.NextID()
    11  	if err != nil {
    12  		// 处理错误
    13  	}
    14  	_ = nid
    15  }