From 1759dab1275d33d2d9c6f3ac2d299ac603241011 Mon Sep 17 00:00:00 2001 From: listen <494177603@qq.com> Date: Sun, 14 Nov 2021 18:14:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=93=8D=E4=BD=9Cmap?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- map.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/map.go b/map.go index 0d0992e..404d585 100644 --- a/map.go +++ b/map.go @@ -110,6 +110,21 @@ func InterfaceToMapInterface(data interface{})(map[string]interface{},error){ return returnData,nil } + +//将interface转成[]map[string]interface +func InterfaceToMapInterfaceArr(data interface{})([]map[string]interface{},error){ + dataJson,err := json.Marshal(data) + + if err != nil { + return nil,err + } + + var returnData []map[string]interface{} + err = json.Unmarshal(dataJson,&returnData) + + return returnData,nil +} + /** * 对map进行字典序排序 * @param data map[string]string