1
0
mirror of synced 2025-12-16 18:18:10 +08:00
Files
SnowFlake-IdGenerator/Python/source/Generator.py
2022-08-07 16:33:59 +08:00

18 lines
383 B
Python

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()