[fix] GetInstance Memory confusion

This commit is contained in:
what 2024-11-26 15:20:08 +08:00
parent 8161aae4ef
commit 66ea462704

View File

@ -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) {