Documentation
¶
Overview ¶
Package movie is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterMovieServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMovieServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MovieServiceClient) error
- func RegisterMovieServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMovieServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MovieServiceServer) error
- func RegisterMovieServiceServer(s grpc.ServiceRegistrar, srv MovieServiceServer)
- type GetMovieRequest
- type GetMovieResponse
- type Movie
- func (*Movie) Descriptor() ([]byte, []int)deprecated
- func (x *Movie) GetCover() string
- func (x *Movie) GetCriticRating() float32
- func (x *Movie) GetTitle() string
- func (x *Movie) GetUserRating() float32
- func (*Movie) ProtoMessage()
- func (x *Movie) ProtoReflect() protoreflect.Message
- func (x *Movie) Reset()
- func (x *Movie) String() string
- type MovieServiceClient
- type MovieServiceServer
- type UnimplementedMovieServiceServer
- type UnsafeMovieServiceServer
Constants ¶
const (
MovieService_GetMovie_FullMethodName = "/movie.MovieService/GetMovie"
)
Variables ¶
var File_grpc_gateway_movie_movie_proto protoreflect.FileDescriptor
var MovieService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "movie.MovieService", HandlerType: (*MovieServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetMovie", Handler: _MovieService_GetMovie_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "grpc-gateway/movie/movie.proto", }
MovieService_ServiceDesc is the grpc.ServiceDesc for MovieService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMovieServiceHandler ¶
func RegisterMovieServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMovieServiceHandler registers the http handlers for service MovieService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMovieServiceHandlerClient ¶
func RegisterMovieServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MovieServiceClient) error
RegisterMovieServiceHandlerClient registers the http handlers for service MovieService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MovieServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MovieServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MovieServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterMovieServiceHandlerFromEndpoint ¶
func RegisterMovieServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMovieServiceHandlerFromEndpoint is same as RegisterMovieServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMovieServiceHandlerServer ¶
func RegisterMovieServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MovieServiceServer) error
RegisterMovieServiceHandlerServer registers the http handlers for service MovieService to "mux". UnaryRPC :call MovieServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMovieServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterMovieServiceServer ¶
func RegisterMovieServiceServer(s grpc.ServiceRegistrar, srv MovieServiceServer)
Types ¶
type GetMovieRequest ¶
type GetMovieRequest struct {
MovieId uint64 `protobuf:"varint,1,opt,name=movie_id,json=movieId,proto3" json:"movie_id,omitempty"`
// contains filtered or unexported fields
}
func (*GetMovieRequest) Descriptor
deprecated
func (*GetMovieRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetMovieRequest.ProtoReflect.Descriptor instead.
func (*GetMovieRequest) GetMovieId ¶
func (x *GetMovieRequest) GetMovieId() uint64
func (*GetMovieRequest) ProtoMessage ¶
func (*GetMovieRequest) ProtoMessage()
func (*GetMovieRequest) ProtoReflect ¶
func (x *GetMovieRequest) ProtoReflect() protoreflect.Message
func (*GetMovieRequest) Reset ¶
func (x *GetMovieRequest) Reset()
func (*GetMovieRequest) String ¶
func (x *GetMovieRequest) String() string
type GetMovieResponse ¶
type GetMovieResponse struct {
Movie *Movie `protobuf:"bytes,1,opt,name=movie,proto3" json:"movie,omitempty"`
// contains filtered or unexported fields
}
func (*GetMovieResponse) Descriptor
deprecated
func (*GetMovieResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetMovieResponse.ProtoReflect.Descriptor instead.
func (*GetMovieResponse) GetMovie ¶
func (x *GetMovieResponse) GetMovie() *Movie
func (*GetMovieResponse) ProtoMessage ¶
func (*GetMovieResponse) ProtoMessage()
func (*GetMovieResponse) ProtoReflect ¶
func (x *GetMovieResponse) ProtoReflect() protoreflect.Message
func (*GetMovieResponse) Reset ¶
func (x *GetMovieResponse) Reset()
func (*GetMovieResponse) String ¶
func (x *GetMovieResponse) String() string
type Movie ¶
type Movie struct {
Cover string `protobuf:"bytes,1,opt,name=cover,proto3" json:"cover,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
CriticRating float32 `protobuf:"fixed32,3,opt,name=critic_rating,json=criticRating,proto3" json:"critic_rating,omitempty"`
UserRating float32 `protobuf:"fixed32,4,opt,name=user_rating,json=userRating,proto3" json:"user_rating,omitempty"`
// contains filtered or unexported fields
}
func (*Movie) Descriptor
deprecated
func (*Movie) GetCriticRating ¶
func (*Movie) GetUserRating ¶
func (*Movie) ProtoMessage ¶
func (*Movie) ProtoMessage()
func (*Movie) ProtoReflect ¶
func (x *Movie) ProtoReflect() protoreflect.Message
type MovieServiceClient ¶
type MovieServiceClient interface {
GetMovie(ctx context.Context, in *GetMovieRequest, opts ...grpc.CallOption) (*GetMovieResponse, error)
}
MovieServiceClient is the client API for MovieService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
protoc --proto_path=api --grpc-gateway_out=.. --go-grpc_out=.. --go_out=.. api/grpc-gateway/movie/movie.proto
func NewMovieServiceClient ¶
func NewMovieServiceClient(cc grpc.ClientConnInterface) MovieServiceClient
type MovieServiceServer ¶
type MovieServiceServer interface {
GetMovie(context.Context, *GetMovieRequest) (*GetMovieResponse, error)
// contains filtered or unexported methods
}
MovieServiceServer is the server API for MovieService service. All implementations must embed UnimplementedMovieServiceServer for forward compatibility.
protoc --proto_path=api --grpc-gateway_out=.. --go-grpc_out=.. --go_out=.. api/grpc-gateway/movie/movie.proto
type UnimplementedMovieServiceServer ¶
type UnimplementedMovieServiceServer struct{}
UnimplementedMovieServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedMovieServiceServer) GetMovie ¶
func (UnimplementedMovieServiceServer) GetMovie(context.Context, *GetMovieRequest) (*GetMovieResponse, error)
type UnsafeMovieServiceServer ¶
type UnsafeMovieServiceServer interface {
// contains filtered or unexported methods
}
UnsafeMovieServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MovieServiceServer will result in compilation errors.