Skip to content

ruhrcloud/snowflake

Repository files navigation

snowflake

License: MIT Release Go Version

Snowflakes are distributed and sortable IDs based on Twitter’s Snowflake algorithm.

By design, the IDs generated are intentionally predictable to maintain sortability. Do not use them for sensitive identifiers like session tokens.

Installation

go get github.com/ruhrcloud/snowflake

Usage

import (
	"fmt"
	"github.com/ruhrcloud/snowflake"
)

func main() {
    node, _ := snowflake.New(1)
    id, _ := node.Generate()
    fmt.Println(id.String())
}

Documentation

Full documentation is available on pkg.go.dev.

About

Go package implementing Twitters Snowflake ID algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages