github.com/ydb-platform/ydb-go-sdk/v3@v3.89.2/internal/xtest/call_method.go (about) 1 package xtest 2 3 import ( 4 "reflect" 5 ) 6 7 func CallMethod(object any, name string, args ...any) []any { 8 method := reflect.ValueOf(object).MethodByName(name) 9 10 inputs := make([]reflect.Value, len(args)) 11 12 for i := range args { 13 inputs[i] = reflect.ValueOf(args[i]) 14 } 15 16 output := method.Call(inputs) 17 18 result := make([]any, len(output)) 19 20 for i := range output { 21 result[i] = output[i].Interface() 22 } 23 24 return result 25 }