Beispiel #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)
	}
}
Beispiel #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
}
Beispiel #3
0
func DemoReflect(m interface{}) {
	fs := mcore.GetFields(m)
	fmt.Println(fs)
}