# README
Snowflake
distributed unique ID generator inspired by Twitter's Snowflake with custom bit assignments:
39 bits for time in units of 10 milliseconds(since 2020-01-01 00:00:00 UTC by default), can hold around 174 yrs of time
16 bits for a node ID
9 bits for a sequence number
snowflake
provide an out of box default settings for usage on public cloud and containers(such as AWS, Azure) by using
the lowest 16 bits of the private ip address as node ID.
NOTE: please don't run multiple instance in same machine/container with the default generator
# Functions
AtomicGenerator define as atomic sequence Resolver, base on standard sync/atomic.
Decompose returns a struct of snowflake ID with the default generator.
NewGenerator create a generator with custom settings.
NewID generate a unique snowflake ID with default settings, use lower 16 bits of current private IP as nodeID which is out-of-box for AWS private networks and also containers, will ignore the errors when generating unique ID.
NextID generate a unique snowflake ID with default settings, use lower 16 bits of current private IP as nodeID which is out-of-box for AWS private networks and also containers, return the errors when generating the unique ID.
# Type aliases
NodeIDProvider the snowflake Node Generator provider.
SequenceGenerator the snowflake sequence generator.