[fix] GetInstance Memory confusion
This commit is contained in:
parent
8161aae4ef
commit
66ea462704
11
base62.go
11
base62.go
@ -12,15 +12,10 @@ type Base62 struct {
|
|||||||
charactersMap map[byte]int // base62 编码规则
|
charactersMap map[byte]int // base62 编码规则
|
||||||
}
|
}
|
||||||
|
|
||||||
var _base62 *Base62
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
_base62 = &Base62{}
|
|
||||||
_base62.SetCharacters([]byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetInstance() *Base62 {
|
func GetInstance() *Base62 {
|
||||||
return _base62
|
b62 := &Base62{}
|
||||||
|
b62.SetCharacters([]byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"))
|
||||||
|
return b62
|
||||||
}
|
}
|
||||||
|
|
||||||
func (base62 *Base62) SetCharacters(characters []byte) (*Base62, error) {
|
func (base62 *Base62) SetCharacters(characters []byte) (*Base62, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user