snowflake in golang
Go
Pull request Compare This branch is 1 commit behind sdming:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
.gitignore
README.md
gosnow.go
gosnow_test.go

README.md

gosnow

gosnow is a snowflake implementation in golang.

This is a fork of the upstream that replaces the the usage of panic() by returning errors instead.

package main

import (
    "github.com/sdming/gosnow"
    "fmt"
)

func main() {

    v, err := gosnow.Default()

    // Alternatively you can set the worker id if you are running multiple snowflakes
    // v, err := gosnow.NewSnowFlake(100)

    for i := 0; i < 10; i++ {
        id, err := v.Next()
        fmt.Println(id)
    }
}