示例#1
0
// PrintModelWithLabel
func PrintModelWithLabel(model interface{}, locale string) {
	fields := mcore.GetFields(model)
	for _, field := range fields {
		l := mtag.GetLocaleLabel(model, field, locale)
		v := mcore.GetFieldValue(model, field)
		fmt.Printf("%s:%v\n", l, v)
	}
}
示例#2
0
// GetModelLabels
// returns model all labels
func GetModelLabels(locale string, model interface{}) (rows []ModelLabel) {
	fs := mcore.GetFields(model)
	for _, f := range fs {
		item := ModelLabel{}
		item.Field = f
		item.Label = GetModelFieldLabel(locale, model, f)
		rows = append(rows, item)
	}
	return
}
示例#3
0
文件: main.go 项目: mabetle/mcore
func DemoReflect(m interface{}) {
	fs := mcore.GetFields(m)
	fmt.Println(fs)
}