mirror of
https://github.com/fxkt-tech/liv
synced 2025-09-26 20:11:20 +08:00
33 lines
417 B
Go
33 lines
417 B
Go
package naming
|
|
|
|
import (
|
|
"fmt"
|
|
"math"
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
func init() {
|
|
rand.Seed(time.Now().Unix())
|
|
}
|
|
|
|
type Naming struct {
|
|
// names map[string]bool
|
|
}
|
|
|
|
func New() *Naming {
|
|
return &Naming{}
|
|
}
|
|
|
|
func (n *Naming) Gen() string {
|
|
return fmt.Sprintf("%x", rand.Int31n(math.MaxInt32))
|
|
}
|
|
|
|
func (n *Naming) Gen64() string {
|
|
return fmt.Sprintf("%x", math.MaxInt64)
|
|
}
|
|
|
|
func (n *Naming) Empty() string {
|
|
return ""
|
|
}
|