本文整理匯總了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
}