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