fusenapi/utils/id_generator/snowflake.go
laodaming 6abca6b271 fix
2023-06-28 17:05:31 +08:00

15 lines
241 B
Go

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
}