Full code is here: https://pastebin.com/xC1uQVBC
type UDD struct {
A string //content = "John"
B string //content = "Male"
C string //content = "12345678"
D int64 //content = ""
E uint64 //content = ""
Z string //content = "FIrst time user"
}
reflect_UDD := reflect.ValueOf(&UDD).Elem()
typeOf_UDD := reflect_UDD.Type()
for i := 0; i < reflect_UDD.NumField(); i++ {
f := reflect_UDD.Field(i)
if(f.Type()==reflect.TypeOf("string")){
//i would like to f.Type()=="string" directly...
//how is this possible and also for uint64 and int64 etc
}
}
Basically, I would like to do something along the lines of
f.Type()=="string"
or
f.Type()=="uint64"
or
f.Type()=="int64"
directly instead