NewClient returns a new sandbox client that handles both GRPC and TTRPC clients.
(client any)
| 28 | |
| 29 | // NewClient returns a new sandbox client that handles both GRPC and TTRPC clients. |
| 30 | func NewClient(client any) (api.TTRPCSandboxService, error) { |
| 31 | switch c := client.(type) { |
| 32 | case *ttrpc.Client: |
| 33 | return api.NewTTRPCSandboxClient(c), nil |
| 34 | case grpc.ClientConnInterface: |
| 35 | return &grpcBridge{api.NewSandboxClient(c)}, nil |
| 36 | default: |
| 37 | return nil, fmt.Errorf("unsupported client type %T", client) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | type grpcBridge struct { |
| 42 | client api.SandboxClient |
no outgoing calls
no test coverage detected
searching dependent graphs…