mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
issue: #33285 - add idAlloc interface - fix binary unsafe bug for message - fix service discovery lost when repeated address with different server id --------- Signed-off-by: chyezh <chyezh@outlook.com>
26 lines
569 B
Go
26 lines
569 B
Go
package message
|
|
|
|
import "strconv"
|
|
|
|
const base = 36
|
|
|
|
// EncodeInt64 encodes int64 to string.
|
|
func EncodeInt64(value int64) string {
|
|
return strconv.FormatInt(value, base)
|
|
}
|
|
|
|
// EncodeUint64 encodes uint64 to string.
|
|
func EncodeUint64(value uint64) string {
|
|
return strconv.FormatUint(value, base)
|
|
}
|
|
|
|
// DecodeUint64 decodes string to uint64.
|
|
func DecodeUint64(value string) (uint64, error) {
|
|
return strconv.ParseUint(value, base, 64)
|
|
}
|
|
|
|
// DecodeInt64 decodes string to int64.
|
|
func DecodeInt64(value string) (int64, error) {
|
|
return strconv.ParseInt(value, base, 64)
|
|
}
|