MCPcopy
hub / github.com/redis/go-redis / toFloat64

Function toFloat64

internal/routing/aggregator.go:653–672  ·  view source on GitHub ↗
(val interface{})

Source from the content-addressed store, hash-verified

651}
652
653func toFloat64(val interface{}) (float64, error) {
654 if val == nil {
655 return 0, nil
656 }
657
658 switch v := val.(type) {
659 case float64:
660 return v, nil
661 case int:
662 return float64(v), nil
663 case int32:
664 return float64(v), nil
665 case int64:
666 return float64(v), nil
667 case float32:
668 return float64(v), nil
669 default:
670 return 0, fmt.Errorf("cannot convert %T to float64", val)
671 }
672}
673
674func toBool(val interface{}) (bool, error) {
675 if val == nil {

Callers 4

AddMethod · 0.70
AddMethod · 0.70
BatchSliceMethod · 0.70
AddMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected