idWorker.go
346 字节
package repository
import (
"github.com/linmadan/egglib-go/utils/snowflake"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/log"
)
var idWorker *snowflake.IdWorker
func init() {
worker, err := snowflake.NewIdWorker(1)
if err != nil {
log.Logger.Panic("idWorker init err" + err.Error())
return
}
idWorker = worker
}