gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/datax/reflectx/ref-desc-type-enum.go (about) 1 package reflectx 2 3 import ( 4 "gitee.com/zhongguo168a/gocodes/datax/schemax" 5 ) 6 7 type EnumTypeRef struct { 8 } 9 10 func (f *EnumTypeRef) RefHas(field string) bool { 11 switch field { 12 case "Decl": 13 return true 14 } 15 return false 16 } 17 18 func (f *EnumTypeRef) RefGet(target IRefObject, EnumType string) (val interface{}, isNil bool) { 19 obj := target.(*schemax.EnumType) 20 switch EnumType { 21 case "Decl": 22 return obj.Decl, false 23 } 24 return nil, true 25 } 26 27 func (f *EnumTypeRef) RefSet(target IRefObject, EnumType string, val interface{}) { 28 obj := target.(*schemax.EnumType) 29 switch EnumType { 30 case "Decl": 31 obj.Decl = val.(string) 32 } 33 return 34 } 35 36 func (f *EnumTypeRef) RefNew() IRefObject { 37 return &schemax.EnumType{} 38 } 39 40 func (f *EnumTypeRef) RefType() string { 41 return "enum" 42 }