MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / documentType

Function documentType

auditlog/message/docs.go:162–189  ·  view source on GitHub ↗
(t reflect.Type, docs map[string]string)

Source from the content-addressed store, hash-verified

160}
161
162func documentType(t reflect.Type, docs map[string]string) DocStruct {
163 var fields []DocField
164 for i := 0; i < t.NumField(); i++ {
165 f := t.Field(i)
166 fieldType := f.Type
167 if fieldType.Kind() == reflect.Func {
168 continue
169 }
170
171 record := DocField{
172 Name: f.Name,
173 DataType: resolveTypeName(fieldType),
174 Comment: docs[t.Name()+"."+f.Name],
175 }
176 if f.Type.Kind() == reflect.Struct {
177 embedded := documentType(f.Type, docs)
178 record.Embedded = &embedded
179 }
180 fields = append(
181 fields, record,
182 )
183 }
184 return DocStruct{
185 Name: t.Name(),
186 Description: docs[t.Name()],
187 Fields: fields,
188 }
189}

Callers 1

documentFunction · 0.85

Calls 2

resolveTypeNameFunction · 0.85
NameMethod · 0.45

Tested by

no test coverage detected