egg-cute-snowflake
TypeScript icon, indicating that this package has built-in type declarations

2.1.7 • Public • Published

egg-cute-snowflake

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-cute-snowflake --save

Usage

// {app_root}/config/plugin.js
exports.snowflake = {
  enable: true,
  package: 'egg-cute-snowflake',
};

Configuration

JAVA 64bit

config.snowflake = {
  app: true,
  agent: true,
  client: {
    twepoch: 1480166465631,
    dataCenterIdBits: 5,
    workerIdBits: 5,
    sequenceBits: 12,
  },
};

Return a 64bit string, for example '553211427826962432'
  
JS 53bit

config.snowflake = {
  app: true,
  agent: true,
  client: {
    twepoch: 1480166465631,
    dataCenterIdBits: 3,
    workerIdBits: 3,
    sequenceBits: 6,
  },
};

Return a 53bit number, for example '540245822818368'

see config/config.default.js for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i egg-cute-snowflake

Weekly Downloads

17

Version

2.1.7

License

MIT

Unpacked Size

15.6 kB

Total Files

14

Last publish

Collaborators

  • wadecha