Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormFields ¶
func FormFields(m interface{}) []string
FormFields get fields names defined in Struct with "form" tag
func ParseModel ¶
func ParseModel(m interface{}, excludeFields []string)
ParseModelForm generate *ModelForm
func SliceToMap ¶
SliceToMap convert []string to [{"text":abc, "value": abc},{}...]
Types ¶
type HtmlForm ¶
type HtmlForm struct {
Name []string // [Name, Desc ...]
Type []string // [input, select, ....]
Required []string // ["required", "", "", "required"]
Help []string
Label []string
Value []interface{}
Options map[string][][]interface{} // options for field
Extra map[string]string // eg: disable
Attrs map[string]map[string]string // attr for field
OptAttrs map[string][]map[string]interface{} // data-link="abc" in option only for select or options
}
type ModelForm ¶
type ModelForm struct {
Name []string // [Name, Desc ...]
Type []string // [input, select, ....]
Required []string // [required, "", "", required]
Help []string // hint
Label []string
Options map[string][]map[string]interface{} // for radio, checkbox, select, {text:text, value: value}
Value []interface{}
Extra map[string]string //data-link="http://www.google.com"
ViewArgs map[string]interface{} // storge all args for view
}
ModelForm struct for form info
Click to show internal directories.
Click to hide internal directories.