Documentation ¶
Index ¶
Constants ¶
View Source
const ( CHAR_SET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789" CHAR_LOWER_SET = "abcdefghjkmnpqrstuvwxyz23456789" )
Variables ¶
View Source
var ErrInvalidBase32 = errors.New("invalid base32")
Functions ¶
func SetIdGeneratorStartTime ¶
SetIdGeneratorStartTime set the start time of the default id generator
func SetStrGeneratorCharSet ¶ added in v0.0.15
func SetStrGeneratorCharSet(charSet string)
Types ¶
type CountGenerator ¶
type CountGenerator struct {
// contains filtered or unexported fields
}
CountGenerator is a generator for count
func (*CountGenerator) AddRule ¶
func (r *CountGenerator) AddRule(period, periodEndMaxIncr, interval, intervalMaxIncr int)
AddRule add count increase rule
type IdGenerator ¶
type IdGenerator struct {
// contains filtered or unexported fields
}
IdGenerator is a id generator
func NewIdGenerator ¶
func NewIdGenerator(startTime time.Time, randBit int) IdGenerator
NewIdGenerator | 1 bit Unused | 41bit timestamp | 2~22bit rand |
type LockRandSource ¶ added in v0.0.15
type LockRandSource struct {
// contains filtered or unexported fields
}
func NewLockRandSource ¶ added in v0.0.15
func NewLockRandSource(seed int64) *LockRandSource
func (*LockRandSource) Int63 ¶ added in v0.0.15
func (r *LockRandSource) Int63() int64
func (*LockRandSource) Seed ¶ added in v0.0.15
func (r *LockRandSource) Seed(seed int64)
type StrGenerator ¶
type StrGenerator struct {
// contains filtered or unexported fields
}
StrGenerator is a random string generator.
func NewStrGenerator ¶
func NewStrGenerator(charSet string, randSource rand.Source) StrGenerator
NewStrGenerator returns a new StrGenerator.
func (*StrGenerator) Generate ¶
func (r *StrGenerator) Generate(n int) string
Generate returns a random string with the specified length.
Click to show internal directories.
Click to hide internal directories.