Browse Source

加入操作map的方法

master v0.2.4
listen 3 years ago
parent
commit
1759dab127
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      map.go

+ 15
- 0
map.go View File

@ -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


Loading…
Cancel
Save