snowflake in golang
Go
Latest commit 3a05c41 Apr 3, 2013 @sdming Merge pull request #1 from 0x6e6562/master
Replace panic with errors
Permalink
Failed to load latest commit information.
example add demo Jun 20, 2012
.gitignore Initial commit Jun 20, 2012
README.md More tweaks to the README Jan 29, 2013
gosnow.go Swap out panic for errors Jan 29, 2013
gosnow_test.go Swap out panic for errors Jan 29, 2013

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)
    }
}