// Some events pushed to Slack require an ID that is always incrementing, // the Snowflake ID generator is perfect for this. func init() { snowflake, err := gosnow.Default() if err != nil { panic(err) } sf = snowflake }
func init() { gosnow.Since = Epoch.UnixNano() / 1000000 var err error DefaultSnowflaker, err = gosnow.Default() if err != nil { panic(err) } }
func main() { v := gosnow.Default() //v := gosnow.NewSnowFlake(100) for i := 0; i < 10; i++ { id := v.Next() fmt.Println(id) } }
func NewTimelineRiakDaoImpl(cluster *riak.Cluster, indexBucket string, logBucket string, daysToKeep int) *TimelineRiakDaoImpl { snowFlake, _ := gosnow.Default() return &TimelineRiakDaoImpl{ Cluster: cluster, IndexDao: NewLogIndexRiakDAO(cluster, indexBucket), LogRecordDao: NewLogRecordRiakDao(cluster, logBucket), SnowFlake: snowFlake, DaysToKeep: daysToKeep, } }
func NewConnectionManager() *ConnectionManager { v, err := gosnow.Default() //v, err := gosnow.NewSnowFlake(100) if err != nil { panic("snowflake init error, msgid can not get!") } return &ConnectionManager{ clients: make(map[string]*Client), sf: v, } }