1
0
mirror of synced 2025-12-16 18:18:10 +08:00
Files
SnowFlake-IdGenerator/zzz (FFI for Python-Node-PHP)/README.md
2021-04-05 15:13:29 +08:00

26 lines
499 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# idgenerator
## FFI 调用
Pyton、node.js、PHP 等可以通过 FFI 方式调用动态库生成 ID。
不同操作系统请引用不同的动态库。
## 接口方法说明
第1步**全局** 初始化(应用程序启动时执行一次):
```
// 设置参数
// workerId
// workerIdBitLength影响 workerId最大值一般设置6。支持的 WorkerId 最大值为2^workerIdBitLength-1
// seqBitLength一般只要设置6.
extern "C" void SetOptions(int workerId, int workerIdBitLength, int seqBitLength)
```
第2步生成ID
```
// 生成ID
extern "C" long NextId()
```