Skip to content

videolabs/gosnow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%