This commit is contained in:
laodaming
2023-06-28 17:05:31 +08:00
parent b012db8e4e
commit 6abca6b271
9 changed files with 320 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
package id_generator
import (
"github.com/bwmarrin/snowflake"
)
func GenSnowFlakeId() (string, error) {
//暂时只用一个节点
n, err := snowflake.NewNode(1)
if err != nil {
return "", err
}
return n.Generate().Base58(), nil
}