You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 738 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
1234567891011121314151617181920212223
  1. # idgenerator
  2. ## ʾRust
  3. 1**ȫ** ʼӦóʱִһΣ
  4. ```
  5. // IdGeneratorOptions ڹ캯 WorkerId
  6. let mut options = IdGeneratorOptions::New(1);
  7. // options.WorkerIdBitLength = 10; // WorkerIdBitLength Ĭֵ6ֵ֧ WorkerId ֵΪ2^6-1 WorkerId 64ø WorkerIdBitLength
  8. // ...... òο IdGeneratorOptions 壬һ˵ֻҪ WorkerIdBitLength WorkerId ֵ
  9. // IJöЧ
  10. YitIdHelper::SetIdGenerator(options);
  11. // ϳʼֻȫһΣұڵ2֮ǰá
  12. ```
  13. 2ID
  14. ```
  15. // ʼԺ󣬼κҪIDĵط·
  16. long newId = YitIdHelper::NextId();
  17. ```

雪花算法中非常好用的数字ID生成器