1
0
mirror of synced 2025-12-20 12:08:02 +08:00

feat: python m1版id生成器

This commit is contained in:
koukouchan
2022-08-07 16:33:59 +08:00
parent 1fb780d634
commit d3c795e3b7
8 changed files with 183 additions and 42 deletions

View File

@@ -0,0 +1,17 @@
from .Options import IdGeneratorOptions
from .SnowFlakeM1 import SnowFlakeM1
class DefaultIdGenerator():
def SetIdGernerator(self, options:IdGeneratorOptions) :
if options.BaseTime < 100000 :
raise ValueError ("BaseTime error.")
self.SnowFlake= SnowFlakeM1(options)
def NextId(self) -> int:
"""
获取新的UUID
"""
return self.SnowFlake.NextId()