From e2c6fb3e9110fd140794f6c01fabe4b71cd0522a 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:20:31 +0800 Subject: [PATCH] =?UTF-8?q?map=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96int64?= =?UTF-8?q?=E5=80=BC=E6=96=B9=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 084695d..e091acf 100644 --- a/map.go +++ b/map.go @@ -250,3 +250,20 @@ func (m Map) GetString(field string) (string, error) { } return AnyDataType(val).ToString().Value(), nil } + +// GetInt64 获取Int64值 +// +// 参数说明: +// - field : 要查找的字段 +// +// Author : go_developer@163.com<白茶清欢> +// +// Date : 15:18 2024/11/21 +func (m Map) GetInt64(field string) (int64, error) { + val, err := m.Get(field) + if nil != err { + return 0, err + } + int64Res := AnyDataType(val).ToString().ToInt64() + return int64Res.Value, int64Res.Err +}