GRPC Programming Model
Jump to navigation
Jump to search
Internal
Instantiate a GRPC Client
A Client Invocation
The generated typed client contains a cc
reference to google.golang.org/grpc
ClientConn
instance, which implements ClientConnInterface
.
When a typed invocation is made, cc
is invoked as such:
cc.Invoke(ctx, "/blue.service.quota.v1.QuotaService/SomeMethod", in, out, opts)
Error Handling
https://grpc.io/docs/guides/error/
https://grpc.io/docs/guides/status-codes/
Use https://pkg.go.dev/google.golang.org/grpc/internal/status
gRPC service handlers should return error created by the status
package, and gRPC clients should expect a corresponding error to be returned from the RPC call.
status.Errorf(codes.InvalidArgument, "request missing required field: Name")
https://grpc.github.io/grpc/core/md_doc_statuscodes.html?ref=apisyouwonthate.com