auto commit
This commit is contained in:
@@ -4,4 +4,22 @@
|
||||
|
||||
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()
|
||||
```
|
||||
|
||||
|
||||
BIN
FFI for Python-Node-PHP/lib/yitidgen-linux-x64.7z
Normal file
BIN
FFI for Python-Node-PHP/lib/yitidgen-linux-x64.7z
Normal file
Binary file not shown.
BIN
FFI for Python-Node-PHP/lib/yitidgen-win-x64.7z
Normal file
BIN
FFI for Python-Node-PHP/lib/yitidgen-win-x64.7z
Normal file
Binary file not shown.
Binary file not shown.
@@ -205,11 +205,15 @@ redis作用
|
||||
|
||||
🌲🏳️🌈 C:[查看示例][5]
|
||||
|
||||
🌲🏳️🌈 Vlang:[查看示例][6]
|
||||
|
||||
如果你有其它语言的实现需求,不妨试着自己写一个,或者给我留言。
|
||||
|
||||
|
||||
[1]: https://gitee.com/yitter/idgenerator/tree/master/C%23.NET
|
||||
[2]: https://gitee.com/yitter/idgenerator/tree/master/Java
|
||||
[3]: https://gitee.com/yitter/idgenerator/tree/master/Go
|
||||
[4]: https://gitee.com/yitter/idgenerator/tree/master/Rust
|
||||
[5]: https://gitee.com/yitter/idgenerator/tree/master/C
|
||||
|
||||
[6]: https://gitee.com/yitter/idgenerator/tree/master/ZeOthers/Vlang
|
||||
|
||||
|
||||
@@ -106,4 +106,5 @@ pub extern "C" fn NextId() -> i64 {
|
||||
// //return 1;
|
||||
// }
|
||||
|
||||
// cargo build --release
|
||||
// build-win-x64: cargo build --release
|
||||
// build-linux-x64: cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
Reference in New Issue
Block a user