本文整理汇总了Golang中github.com/ungerik/go-start/model.MetaData.IsSelfOrParentIndexed方法的典型用法代码示例。如果您正苦于以下问题:Golang MetaData.IsSelfOrParentIndexed方法的具体用法?Golang MetaData.IsSelfOrParentIndexed怎么用?Golang MetaData.IsSelfOrParentIndexed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ungerik/go-start/model.MetaData
的用法示例。
在下文中一共展示了MetaData.IsSelfOrParentIndexed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewInput
func (self ModelStringController) NewInput(withLabel bool, metaData *model.MetaData, form *Form) (input View, err error) {
str := metaData.Value.Addr().Interface().(*model.String)
textField := &TextField{
Class: form.FieldInputClass(metaData),
Name: metaData.Selector(),
Text: str.Get(),
Size: form.GetInputSize(metaData),
Disabled: form.IsFieldDisabled(metaData),
Placeholder: form.InputFieldPlaceholder(metaData),
Required: form.IsFieldRequired(metaData) && !metaData.IsSelfOrParentIndexed(),
Title: form.FieldLabel(metaData),
}
if maxlen, ok, _ := str.Maxlen(metaData); ok {
textField.MaxLength = maxlen
if maxlen < textField.Size {
textField.Size = maxlen
}
}
if metaData.BoolAttrib("view", "search") {
textField.Type = SearchTextField
}
if metaData.BoolAttrib("view", "autofocus") {
textField.Autofocus = true
}
if pattern, ok := metaData.Attrib("view", "pattern"); ok {
textField.Pattern = pattern
}
if withLabel {
return AddStandardLabel(form, textField, metaData), nil
}
return textField, nil
}