Beispiel #1
0
func parseAlias(rv map[string]interface{}, v *Value, errFunc ErrorFunc, relname string) {
	alias, ok := rv["alias"]
	if !ok {
		return
	}

	if alias == nil {
		v.Alias = ""
		v.HasAlias = false
		return
	}

	if s, ok := alias.(string); ok {
		if !util.ValidateRelOwnerName(s) {
			errFunc.add(fmt.Errorf("malformed alias name"))
			return
		}

		v.Alias = s
		v.HasAlias = true
		return
	}

	errFunc.add(fmt.Errorf("unknown alias field format"))
}
Beispiel #2
0
func parseTranslate(rv map[string]interface{}, v *Value, errFunc ErrorFunc, relname string) {
	translate, ok := rv["translate"]
	if !ok {
		return
	}

	if translate == nil {
		v.Translate = ""
		v.HasTranslate = false
		return
	}

	if s, ok := translate.(string); ok {
		if !util.ValidateRelOwnerName(s) {
			errFunc.add(fmt.Errorf("malformed translate name"))
			return
		}
		v.Translate = s
		v.HasTranslate = true
		return
	}

	errFunc.add(fmt.Errorf("unknown translate field format"))
}