mirror of
				https://github.com/beego/bee.git
				synced 2025-10-31 07:23:22 +00:00 
			
		
		
		
	添加自定义的对象显示类型
This commit is contained in:
		| @@ -93,6 +93,10 @@ var stdlibObject = map[string]string{ | ||||
| 	"&{json RawMessage}": "json.RawMessage", | ||||
| } | ||||
|  | ||||
| var customObject = map[string]string{ | ||||
| 	"&{base ObjectID}": "string", | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	pkgCache = make(map[string]struct{}) | ||||
| 	controllerComments = make(map[string]string) | ||||
| @@ -1236,6 +1240,9 @@ func typeAnalyser(f *ast.Field) (isSlice bool, realType, swaggerType string) { | ||||
| 		if isBasicType(fmt.Sprint(arr.Elt)) { | ||||
| 			return true, fmt.Sprintf("[]%v", arr.Elt), basicTypes[fmt.Sprint(arr.Elt)] | ||||
| 		} | ||||
| 		if object, isCustomObject := customObject[fmt.Sprint(arr.Elt)]; isCustomObject { | ||||
| 			return true, fmt.Sprintf("[]%v", object), basicTypes[object] | ||||
| 		} | ||||
| 		if mp, ok := arr.Elt.(*ast.MapType); ok { | ||||
| 			return false, fmt.Sprintf("map[%v][%v]", mp.Key, mp.Value), astTypeObject | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 wucheng
					wucheng