func init() { constructorMap = make(map[string]func() interface{}) constructorMap["get"] = func() interface{} { return cassandra.NewGetArgs() } constructorMap["get_slice"] = func() interface{} { return cassandra.NewGetSliceArgs() } constructorMap["get_count"] = func() interface{} { return cassandra.NewGetCountArgs() } constructorMap["insert"] = func() interface{} { return cassandra.NewInsertArgs() } constructorMap["add"] = func() interface{} { return cassandra.NewAddArgs() } constructorMap["remove"] = func() interface{} { return cassandra.NewRemoveArgs() } constructorMap["remove_counter"] = func() interface{} { return cassandra.NewRemoveCounterArgs() } }
func Test_ConstructorMap(t *testing.T) { fnMap := make(map[string]func() interface{}) fnMap["get"] = func() interface{} { return cassandra.NewGetArgs() } rv := fnMap["get"]() t.Log("rv: ", reflect.TypeOf(rv)) tt := reflect.TypeOf(rv) rm, valid := tt.MethodByName("Read") if valid { t.Log("rm: ", rm) v := rm.Func t.Log("fun: ", v) } }
func Test_CassThing(t *testing.T) { gargs := cassandra.NewGetArgs() t.Log("shit: ", reflect.TypeOf(gargs)) }