interface{} to any
This commit is contained in:
parent
7af6e70d8b
commit
d714f293f8
@ -1144,11 +1144,11 @@ func (s *Stream) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetStats returns stream statistics
|
// GetStats returns stream statistics
|
||||||
func (s *Stream) GetStats() map[string]interface{} {
|
func (s *Stream) GetStats() map[string]any {
|
||||||
s.mu.RLock()
|
s.mu.RLock()
|
||||||
defer s.mu.RUnlock()
|
defer s.mu.RUnlock()
|
||||||
|
|
||||||
return map[string]interface{}{
|
return map[string]any{
|
||||||
"packets_out": atomic.LoadUint64(&s.packetsOut),
|
"packets_out": atomic.LoadUint64(&s.packetsOut),
|
||||||
"packets_in": atomic.LoadUint64(&s.packetsIn),
|
"packets_in": atomic.LoadUint64(&s.packetsIn),
|
||||||
"bytes_out": atomic.LoadUint64(&s.bytesOut),
|
"bytes_out": atomic.LoadUint64(&s.bytesOut),
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// CalculateSize uses reflection to calculate the serialized size of a struct
|
// CalculateSize uses reflection to calculate the serialized size of a struct
|
||||||
func CalculateSize(v interface{}) uint32 {
|
func CalculateSize(v any) uint32 {
|
||||||
return calculateSizeValue(reflect.ValueOf(v))
|
return calculateSizeValue(reflect.ValueOf(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ type SizeCalculator interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CalculateSizeOptimized uses the Size() method if available, otherwise uses reflection
|
// CalculateSizeOptimized uses the Size() method if available, otherwise uses reflection
|
||||||
func CalculateSizeOptimized(v interface{}) uint32 {
|
func CalculateSizeOptimized(v any) uint32 {
|
||||||
if sc, ok := v.(SizeCalculator); ok {
|
if sc, ok := v.(SizeCalculator); ok {
|
||||||
return sc.Size()
|
return sc.Size()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user