(entity interface{}, docs map[string]string)
| 105 | } |
| 106 | |
| 107 | func document(entity interface{}, docs map[string]string) DocStruct { |
| 108 | t := reflect.TypeOf(entity) |
| 109 | if t.Kind() == reflect.Ptr { |
| 110 | t = t.Elem() |
| 111 | } |
| 112 | if t.Kind() == reflect.Interface { |
| 113 | t = reflect.ValueOf(t).Elem().Type() |
| 114 | } |
| 115 | if t.Kind() != reflect.Struct { |
| 116 | panic(t.Name() + " is not a struct") |
| 117 | } |
| 118 | return documentType(t, docs) |
| 119 | } |
| 120 | |
| 121 | func resolveTypeName(fieldType reflect.Type) string { |
| 122 | switch fieldType.Kind() { |
no test coverage detected