Documentation
¶
Overview ¶
Package transcode serves the REST surface of gRPC services: it maps the google.api.http bindings generated into internal/apidef onto the services' gRPC implementations (AIP-127), validating each request's field behaviours on the way in.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Transcoder ¶
type Transcoder struct {
// contains filtered or unexported fields
}
Transcoder serves REST for gRPC services (AIP-127), so REST and gRPC share one code path.
func (*Transcoder) AddServer ¶
func (t *Transcoder) AddServer(name string, impl any) error
AddServer routes the generated HTTP bindings of the named gRPC service to impl's methods, for services whose generated code offers no grpc.ServiceDesc (google.cloud.location.Locations).
func (*Transcoder) AddService ¶
func (t *Transcoder) AddService(sd *grpc.ServiceDesc, impl any) error
AddService routes every method of sd that has a generated HTTP binding (internal/apidef) to impl, through the generated gRPC handlers.
func (*Transcoder) RegisterService ¶
func (t *Transcoder) RegisterService(sd *grpc.ServiceDesc, impl any)
RegisterService implements grpc.ServiceRegistrar, so generated RegisterXServer functions can register onto the REST surface too. It panics if sd has no generated definition: that is a build-time mistake.
func (*Transcoder) ServeHTTP ¶
func (t *Transcoder) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP routes r to the best matching binding.