/
githubmirror
/
ydb-go-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-go-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/xtest/call_method.go
25 строк
417 B
Aleksey Myasnikov
* Added public package `pkg/xtest` with test helpers (#1850)
17 авг 2025, 18:24
Не верифицирован
17 авг 2025, 18:24
82a8722
Код
Авторство
О чём код?
package xtest import ( "reflect" ) func CallMethod(object any, name string, args ...any) []any { method := reflect.ValueOf(object).MethodByName(name) inputs := make([]reflect.Value, len(args)) for i := range args { inputs[i] = reflect.ValueOf(args[i]) } output := method.Call(inputs) result := make([]any, len(output)) for i := range output { result[i] = output[i].Interface() } return result }