snow

LICENSE
codecov
GitHub Stars

Snowflake by Go.

package main

import "github.com/czasg/snow"

func main() {
    // default WorkID & DataCenterID is 0.
    snowID := snow.Next()
    
    // self-define WorkID / DataCenterID
    s := snow.Snow{
        WorkID:       1,
        DataCenterID: 2,
    }
    snowID = s.Next()
}

GitHub

View Github