1
0
Fork 0

Ignored attribute

This commit is contained in:
Gregory Eremin 2015-01-18 18:31:36 +07:00
parent e7d10843db
commit 0baecc0a6f
2 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,7 @@ const (
tOptions = "options"
aRequired = "required"
aReadonly = "readonly"
aIgnored = "ignored"
sep = ","
)
@ -68,6 +69,7 @@ func (c *config) meta(prefix string) []*configField {
panic(fmt.Errorf("Config is expected to be a Struct, not %s", ckind.String()))
}
loop_over_fields:
for i := 0; i < cval.NumField(); i++ {
var (
field = ctyp.Field(i)
@ -105,6 +107,9 @@ func (c *config) meta(prefix string) []*configField {
if attr == aReadonly {
cf.IsReadonly = true
}
if attr == aIgnored {
continue loop_over_fields
}
}
fields = append(fields, cf)

View File

@ -13,6 +13,7 @@ type (
EnableSignIn bool `json:"enable_sign_in" title:"Enable Sign-In"`
DatabaseDriver string `json:"database_driver" title:"Database Driver" options:"mysql,postgresql,mssql"`
DatabaseConfig DatabaseConfig `json:"database_config"`
SensitiveData string `json:"sensitive_data" attrs:"ignored"`
}
DatabaseConfig struct {
Hostname string `json:"hostname"`