init.go 402 B

123456789101112131415161718192021222324
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package id
  4. import (
  5. "time"
  6. "github.com/sony/sonyflake"
  7. )
  8. var sf *sonyflake.Sonyflake
  9. func init() {
  10. st := sonyflake.Settings{
  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. }