You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
339 B
Go
23 lines
339 B
Go
package hashid
|
|
|
|
import (
|
|
"joybuywork/internal/app"
|
|
"fmt"
|
|
"github.com/rs/xid"
|
|
)
|
|
|
|
// Id 20位的字符Id
|
|
func Id() string {
|
|
return xid.New().String()
|
|
}
|
|
|
|
// IdBase16 16进制的id
|
|
func IdBase16() string {
|
|
return fmt.Sprintf("%x", IdBigint())
|
|
}
|
|
|
|
// IdBigint 整形id
|
|
func IdBigint() int64 {
|
|
return app.SnowFlakeNode.Generate().Int64()
|
|
}
|