gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/datax/schemax/field.go (about) 1 package schemax 2 3 import "reflect" 4 5 type UnsafeInfo struct { 6 Offset uintptr 7 Kind reflect.Kind 8 } 9 10 type Field struct { 11 Name string 12 // 13 Type IType 14 // 如果Type=ClassType, 可通过设置{}建立新对象, 否则默认为nil 15 // 如果Type=MapType, 可通过设置{}建立新对象, 否则默认为nil 16 // 如果Type=BasicType/EnumType, Value为初始值 17 Value string 18 // 19 Comments []string 20 // 21 Tags map[string]string 22 // 23 //Unsafe UnsafeInfo 24 } 25 26 func (typ *Field) RefType() string { 27 return "field" 28 } 29 30 func (typ *Field) Alias() string { 31 if typ.Tags != nil { 32 json, has := typ.Tags["json"] 33 if has { 34 return json 35 } 36 37 alias, has := typ.Tags["alias"] 38 if has { 39 return alias 40 } 41 } 42 43 return typ.Name 44 }