Home

Awesome

Sandflake Build Status GoDoc License Go Report Card

Decentralized, sequential, lexicographically sortable unique id

This is a work in progress, things might change quickly without notice

Features

Table of contents

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->

Install/Update

go get -u github.com/celrenheit/sandflake

Usage

var g sandflake.Generator
id := g.Next()
fmt.Println(id)

Composition

Sandflake ids do not need to wait some milliseconds for the next id if time goes backwards, it can just generate new ones and random bytes at the end should avoid any possible conflict with previous ids. In this case, the order is not guaranteed anymore.

Likewise, for future manually generated ids, the order is not guaranteed.

Ports

Inspiration

License

Apache 2.0