chyezh cc8f7aa110
fix: streaming service related fix patch (#34696)
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>
2024-07-16 15:49:38 +08:00

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)
}