1.0.0 • Published 7 years ago

shard-uuid v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

ShardUUID

Compact 64-bit UUID generator for database logical shards.

NPM Version Node.js Version NPM Downloads

Each UUID consists of:

  • 32 bits for time in seconds (gives 136 years of IDs from start of epoch 2017-01-01 00:00:00);
  • 22 bits that represent the logical shard ID;
  • 10 bits that represent an auto-incrementing sequence (modulus 1024).

Installation

$ npm install --save shard-uuid

Usage

const shardUUID = require('shard-uuid');

shardUUID.getUUID(65536, 1023, false).then((uuid) => {
    console.log(uuid);
}).catch((err) => {});

License: MIT

1.0.0

7 years ago