@cdlab996/genid
Advanced tools
+1
-1
@@ -186,3 +186,3 @@ | ||
| const result = (BigInt(useTimeTick) << this._timestampShift) + (this.workerId << this.seqBitLength) + BigInt(this._turnBackIndex); | ||
| this._turnBackTimeTick--; | ||
| this._turnBackTimeTick++; | ||
| this._stats.totalGenerated++; | ||
@@ -189,0 +189,0 @@ return result; |
+1
-1
@@ -185,3 +185,3 @@ //#region src/types/index.ts | ||
| const result = (BigInt(useTimeTick) << this._timestampShift) + (this.workerId << this.seqBitLength) + BigInt(this._turnBackIndex); | ||
| this._turnBackTimeTick--; | ||
| this._turnBackTimeTick++; | ||
| this._stats.totalGenerated++; | ||
@@ -188,0 +188,0 @@ return result; |
+14
-12
| { | ||
| "name": "@cdlab996/genid", | ||
| "type": "module", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "基于 Snowflake 算法的高性能分布式唯一 ID 生成器", | ||
@@ -49,14 +49,7 @@ "author": "wudi <wuchendi96@gmail.com>", | ||
| }, | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "dev": "tsdown --watch", | ||
| "test": "vitest --run", | ||
| "test:watch": "vitest", | ||
| "typecheck": "tsc --project tsconfig.json" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^22", | ||
| "tsdown": "^0.15.7", | ||
| "@types/node": "^24", | ||
| "tsdown": "^0.15.9", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^3.2.4" | ||
| "vitest": "^4.0.2" | ||
| }, | ||
@@ -66,3 +59,12 @@ "publishConfig": { | ||
| "registry": "https://registry.npmjs.org/" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsdown", | ||
| "dev": "tsdown --watch", | ||
| "test": "vitest --run", | ||
| "test:index": "vitest --run tests/index.test.ts", | ||
| "test:performance": "vitest --run tests/performance.test.ts", | ||
| "test:stress": "vitest --run tests/stress.test.ts", | ||
| "typecheck": "tsc --project tsconfig.json" | ||
| } | ||
| } | ||
| } |
+1
-7
| # @cdlab996/genid | ||
| 一个基于 Snowflake 算法的高性能分布式唯一 ID 生成器。 | ||
| 基于 Snowflake 算法的高性能分布式唯一 ID 生成器,支持漂移算法和时钟回拨处理,适用于分布式系统中的唯一标识生成需求。 | ||
@@ -50,8 +50,2 @@ ## 特性 | ||
| R --> S[返回 ID] | ||
| style B fill:#fff4e6 | ||
| style E fill:#e8f5e9 | ||
| style K fill:#fce4ec | ||
| style Q fill:#f3e5f5 | ||
| style S fill:#c8e6c9 | ||
| ``` | ||
@@ -58,0 +52,0 @@ |
59399
0.18%290
-2.03%