File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -115,23 +115,25 @@ console.log(new Date(makeUUID.baseClock)); // See the base-clock
115
115
``` ts
116
116
import * as libuuid from " @litert/uuid" ;
117
117
118
- const makeUUID = libuuid .SnowflakeSIvA .createGenerateor ({
118
+ const factory = UUID .SnowflakeBIvA .createFactory ();
119
+
120
+ const makeUUID = factory .create ({
119
121
120
122
/**
121
123
* The ID of machine, 0 ~ 1023
122
124
*/
123
- " mid " : 333 ,
125
+ " machineId " : 333 ,
124
126
125
127
/**
126
128
* Calculate the cursor of the incremental sequence insides generator by
127
129
* the last generated UUID.
128
130
*/
129
- " cursor" : libuuid . SnowflakeSIvA .calculateCursor (1562244321456127 )
131
+ " cursor" : factory .calculateCursor (1562244321456127 )
130
132
});
131
133
132
134
console .log (nextUUID ());
133
135
console .log (nextUUID ());
134
- console .log (nextUUID .MACHINE_ID );
136
+ console .log (nextUUID .machineId );
135
137
console .log (Number .isSafeInteger (nextUUID ()));
136
138
137
139
```
Original file line number Diff line number Diff line change @@ -111,7 +111,9 @@ console.log(new Date(makeUUID.baseClock)); // 查看 UUID 生成器的业务基
111
111
``` ts
112
112
import * as libuuid from " @litert/uuid" ;
113
113
114
- const makeUUID = libuuid .SnowflakeSIvA .createGenerateor ({
114
+ const factory = UUID .SnowflakeBIvA .createFactory ();
115
+
116
+ const makeUUID = factory .create ({
115
117
116
118
/**
117
119
* 机器序号,取值范围:0 ~ 1023。
@@ -121,12 +123,12 @@ const makeUUID = libuuid.SnowflakeSIvA.createGenerateor({
121
123
/**
122
124
* 根据上一次生成的 UUID 重新计算内部递增序列指针。
123
125
*/
124
- " cursor" : libuuid . SnowflakeSIvA .calculateCursor (1562244321456127 )
126
+ " cursor" : factory .calculateCursor (1562244321456127 )
125
127
});
126
128
127
129
console .log (nextUUID ());
128
130
console .log (nextUUID ());
129
- console .log (nextUUID .MACHINE_ID );
131
+ console .log (nextUUID .machineId );
130
132
console .log (Number .isSafeInteger (nextUUID ()));
131
133
132
134
```
You can’t perform that action at this time.
0 commit comments