Config includes all fields now
unless field has "ignored" attribute
This commit is contained in:
parent
2ce470432c
commit
ab364e1908
26
config.go
26
config.go
|
@ -86,17 +86,7 @@ loop_over_fields:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if title != "" || len(attrs) > 0 || len(options) > 0 {
|
if len(attrs) > 0 {
|
||||||
// Substitute field name for title if none set
|
|
||||||
if kind != reflect.Struct {
|
|
||||||
cf.Value = val.Interface()
|
|
||||||
}
|
|
||||||
if title == "" {
|
|
||||||
cf.Title = field.Name
|
|
||||||
}
|
|
||||||
if len(options) > 0 {
|
|
||||||
cf.Options = strings.Split(options, sep)
|
|
||||||
}
|
|
||||||
for _, attr := range strings.Split(attrs, sep) {
|
for _, attr := range strings.Split(attrs, sep) {
|
||||||
if attr == aRequired {
|
if attr == aRequired {
|
||||||
cf.IsRequired = true
|
cf.IsRequired = true
|
||||||
|
@ -109,9 +99,21 @@ loop_over_fields:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fields = append(fields, cf)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Substitute field name for title if none set
|
||||||
|
if kind != reflect.Struct {
|
||||||
|
cf.Value = val.Interface()
|
||||||
|
}
|
||||||
|
if title == "" {
|
||||||
|
cf.Title = field.Name
|
||||||
|
}
|
||||||
|
if len(options) > 0 {
|
||||||
|
cf.Options = strings.Split(options, sep)
|
||||||
|
}
|
||||||
|
|
||||||
|
fields = append(fields, cf)
|
||||||
|
|
||||||
// Recursion here
|
// Recursion here
|
||||||
if kind == reflect.Struct {
|
if kind == reflect.Struct {
|
||||||
subconf := &config{
|
subconf := &config{
|
||||||
|
|
Loading…
Reference in New Issue