feat: id utils

This commit is contained in:
Bobo
2025-06-04 22:17:05 +08:00
parent 99c8f6e4c1
commit 9c450415a2
3 changed files with 11 additions and 1 deletions

View File

@@ -59,3 +59,8 @@ func NewSnowflakeID(workerId int64) (int64, error) {
return node.Generate(), nil
}
func GenerateSnowflakeID(workerId int64) int64 {
id, _ := NewSnowflakeID(workerId)
return id
}

View File

@@ -23,3 +23,8 @@ func NewSonyflakeID() (uint64, error) {
return sf.NextID()
}
func GenerateSonyflakeID() uint64 {
id, _ := NewSonyflakeID()
return id
}