You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go-hashids provides EncodeInt64 but it actually rejects negative numbers in below. Does it make sense to use uint64, or provides a uint64 variant?
// EncodeInt64 hashes an array of int64 to a string containing at least MinLength characters taken from the Alphabet.// Use DecodeInt64 using the same Alphabet and Salt to get back the array of int64.func (h*HashID) EncodeInt64(numbers []int64) (string, error) {
iflen(numbers) ==0 {
return"", errors.New("encoding empty array of numbers makes no sense")
}
for_, n:=rangenumbers {
ifn<0 {
return"", errors.New("negative number not supported")
}
}
I'm using go-hashids along with hashids' Ruby implementation. In some cases, go-hashids rejects inputs that exceed MaxInt, while the Ruby implementation can handle it because Ruby's Integer can be larger than Go's MaxInt.
I made a fork to workaround the issue and happy to upstream something like this.
Uh oh!
There was an error while loading. Please reload this page.
go-hashids provides EncodeInt64 but it actually rejects negative numbers in below. Does it make sense to use uint64, or provides a uint64 variant?
I'm using go-hashids along with hashids' Ruby implementation. In some cases, go-hashids rejects inputs that exceed MaxInt, while the Ruby implementation can handle it because Ruby's Integer can be larger than Go's MaxInt.
I made a fork to workaround the issue and happy to upstream something like this.
https://github.com/kzys/go-hashids/
The text was updated successfully, but these errors were encountered: