init.go 378 B

1234567891011121314151617181920212223
  1. package id
  2. import (
  3. "time"
  4. "github.com/sony/sonyflake"
  5. //"github.com/sony/sonyflake/awsutil"
  6. )
  7. var sf *sonyflake.Sonyflake
  8. func init() {
  9. st := sonyflake.Settings{
  10. //MachineID: awsutil.AmazonEC2MachineID,
  11. StartTime: time.Date(2010, time.October, 10, 10, 10, 10, 0, time.UTC),
  12. }
  13. sf = sonyflake.NewSonyflake(st)
  14. if sf == nil {
  15. panic("init unique id panic")
  16. }
  17. }