mirror of
https://github.com/beego/bee.git
synced 2024-11-22 05:00:54 +00:00
bee: update other type
This commit is contained in:
parent
2be298dd8e
commit
33eaf8c2b7
@ -557,7 +557,7 @@ func getModel(str string) (pkgpath, objectname string, m swagger.Model, realType
|
|||||||
|
|
||||||
func typeAnalyser(f *ast.Field) (isSlice bool, realType string) {
|
func typeAnalyser(f *ast.Field) (isSlice bool, realType string) {
|
||||||
if arr, ok := f.Type.(*ast.ArrayType); ok {
|
if arr, ok := f.Type.(*ast.ArrayType); ok {
|
||||||
if fmt.Sprint(arr.Elt) == "byte" {
|
if isBasicType(fmt.Sprint(arr.Elt)) {
|
||||||
return false, ""
|
return false, ""
|
||||||
}
|
}
|
||||||
if _, ok := arr.Elt.(*ast.MapType); ok {
|
if _, ok := arr.Elt.(*ast.MapType); ok {
|
||||||
@ -569,9 +569,8 @@ func typeAnalyser(f *ast.Field) (isSlice bool, realType string) {
|
|||||||
return true, fmt.Sprint(arr.Elt)
|
return true, fmt.Sprint(arr.Elt)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false, ""
|
return false, fmt.Sprint(f.Type)
|
||||||
}
|
}
|
||||||
return isSlice, realType[strings.Index(realType, "Elt:")+4 : len(realType)-1]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func isBasicType(Type string) bool {
|
func isBasicType(Type string) bool {
|
||||||
@ -585,7 +584,7 @@ func isBasicType(Type string) bool {
|
|||||||
|
|
||||||
// refer to builtin.go
|
// refer to builtin.go
|
||||||
var basicTypes = []string{
|
var basicTypes = []string{
|
||||||
"bool",
|
"bool", "byte",
|
||||||
"uint", "uint8", "uint16", "uint32", "uint64",
|
"uint", "uint8", "uint16", "uint32", "uint64",
|
||||||
"int", "int8", "int16", "int32", "int64",
|
"int", "int8", "int16", "int32", "int64",
|
||||||
"float32", "float64",
|
"float32", "float64",
|
||||||
@ -607,7 +606,7 @@ func grepJsonTag(tag string) string {
|
|||||||
// append models
|
// append models
|
||||||
func appendModels(cmpath, pkgpath, controllerName string, realTypes []string) {
|
func appendModels(cmpath, pkgpath, controllerName string, realTypes []string) {
|
||||||
for _, realType := range realTypes {
|
for _, realType := range realTypes {
|
||||||
if realType != "" && !isBasicType(realType) {
|
if realType != "" && strings.HasPrefix(realType, "[]") {
|
||||||
if cmpath != "" {
|
if cmpath != "" {
|
||||||
cmpath = strings.Join(strings.Split(cmpath, "/"), ".") + "."
|
cmpath = strings.Join(strings.Split(cmpath, "/"), ".") + "."
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user