// Validate returns an error if the metric value does not match its definition.
Validate returns an error if the metric value does not match its definition.
// Validate returns an error if the metric value does not match its definition .
func (mv MetricValue) Validate(def Definition) error {
	switch def.Type {
	case IntType:
		if mv.DoubleValue != nil {
			return fmt.Errorf("double value specified for integer metric: %v", *mv.DoubleValue)
		}
		break
	case DoubleType:
		if mv.Int64Value != nil {
			return fmt.Errorf("integer value specified for double metric: %v", *mv.Int64Value)
		}
		break
	}
	return nil
}
func ( mv MetricValue ) Validate ( def Definition ) error { switch def . Type { case IntType : if mv . DoubleValue != nil { return fmt . Errorf ( " " , * mv . DoubleValue ) } break case DoubleType : if mv . Int64Value != nil { return fmt . Errorf ( " " , * mv . Int64Value ) } break } return nil }
Validate returns an error if the metric value does not match its definition.
Validate returns an error if the metric value does not match its definition .