MCPcopy Index your code
hub / github.com/cortexproject/cortex / getFieldName

Function getFieldName

tools/doc-generator/parser.go:254–276  ·  view source on GitHub ↗
(field reflect.StructField)

Source from the content-addressed store, hash-verified

252}
253
254func getFieldName(field reflect.StructField) string {
255 name := field.Name
256 tag := field.Tag.Get("yaml")
257
258 // If the tag is not specified, then an exported field can be
259 // configured via the field name (lowercase), while an unexported
260 // field can't be configured.
261 if tag == "" {
262 if unicode.IsLower(rune(name[0])) {
263 return ""
264 }
265
266 return strings.ToLower(name)
267 }
268
269 // Parse the field name
270 fieldName := yamlFieldNameParser.FindString(tag)
271 if fieldName == "-" {
272 return ""
273 }
274
275 return fieldName
276}
277
278func getFieldType(t reflect.Type) (string, error) {
279 // Handle custom data types used in the config

Callers 2

parseConfigFunction · 0.85
getCustomFieldEntryFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected