コード例 #1
0
ファイル: model_util.go プロジェクト: mabetle/mcore
// 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
ファイル: i18n_model.go プロジェクト: mabetle/mmsg
// 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)
}