31 lines
489 B
Go
31 lines
489 B
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
oas "git.loafle.net/overflow/overflow_api_server/golang"
|
|
)
|
|
|
|
func Exec(ctx context.Context, method string, params []string) (string, error) {
|
|
c, err := _pool.Get()
|
|
if nil != err {
|
|
|
|
}
|
|
defer _pool.Put(c)
|
|
sm := strings.Split(method, ".")
|
|
|
|
si := &oas.ServerInput{
|
|
Target: sm[0],
|
|
Method: sm[1],
|
|
Params: params,
|
|
}
|
|
|
|
so, err := c.(oas.OverflowApiServerClient).Exec(ctx, si)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return so.Result, nil
|
|
}
|