From b435398a943dc1c4ea8ac00f538ba26103884180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 21 Nov 2024 15:25:08 +0800 Subject: [PATCH] =?UTF-8?q?map=E5=A2=9E=E5=8A=A0GetFloat64=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- map.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/map.go b/map.go index e091acf..c418fbe 100644 --- a/map.go +++ b/map.go @@ -267,3 +267,20 @@ func (m Map) GetInt64(field string) (int64, error) { int64Res := AnyDataType(val).ToString().ToInt64() return int64Res.Value, int64Res.Err } + +// GetFloat64 获取float64值 +// +// 参数说明: +// - field : 要查找的字段 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 15:18 2024/11/21 +func (m Map) GetFloat64(field string) (float64, error) { + val, err := m.Get(field) + if nil != err { + return 0, err + } + float64Res := AnyDataType(val).ToString().ToFloat64() + return float64Res.Value, float64Res.Err +}