From c16a4cada54c6c22a212848b1efae313293f0667 Mon Sep 17 00:00:00 2001 From: Mathevet julien Date: Fri, 30 Oct 2020 17:36:40 +0100 Subject: [PATCH] allow to convert bool to float --- rules/update_field_type.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/update_field_type.go b/rules/update_field_type.go index 2ea1e51..529eae4 100644 --- a/rules/update_field_type.go +++ b/rules/update_field_type.go @@ -250,7 +250,8 @@ func castToFloat(value tsm1.Value) (tsm1.Value, bool, error) { case uint64: return tsm1.NewFloatValue(value.UnixNano(), float64(value.Value().(uint64))), false, nil case bool: - return nil, false, fmt.Errorf("Could not cast bool value to float") + b := value.Value().(bool) + return tsm1.NewFloatValue(value.UnixNano(), float64(btoi(b))), false, nil case string: v, err := strconv.ParseFloat(value.Value().(string), 64) if err != nil {