Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterMyGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMyGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MyGreeterClient) error
- func RegisterMyGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMyGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MyGreeterServer) error
- func RegisterMyGreeterServer(s grpc.ServiceRegistrar, srv MyGreeterServer)
- type Address
- func (*Address) Descriptor() ([]byte, []int)deprecated
- func (x *Address) GetCity() string
- func (x *Address) GetState() string
- func (x *Address) GetStreet() string
- func (x *Address) GetZipcode() int32
- func (*Address) ProtoMessage()
- func (x *Address) ProtoReflect() protoreflect.Message
- func (x *Address) Reset()
- func (x *Address) String() string
- type HelloReply
- type HelloRequest
- func (*HelloRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HelloRequest) GetAddress() *Address
- func (x *HelloRequest) GetAge() int32
- func (x *HelloRequest) GetEmail() string
- func (x *HelloRequest) GetName() string
- func (*HelloRequest) ProtoMessage()
- func (x *HelloRequest) ProtoReflect() protoreflect.Message
- func (x *HelloRequest) Reset()
- func (x *HelloRequest) String() string
- type MyGreeterClient
- type MyGreeterServer
- type UnimplementedMyGreeterServer
- type UnsafeMyGreeterServer
Constants ¶
const (
MyGreeter_SayHello_FullMethodName = "/MyGreeter/SayHello"
)
Variables ¶
var File_api_proto protoreflect.FileDescriptor
var MyGreeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "MyGreeter", HandlerType: (*MyGreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _MyGreeter_SayHello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api.proto", }
MyGreeter_ServiceDesc is the grpc.ServiceDesc for MyGreeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMyGreeterHandler ¶
func RegisterMyGreeterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMyGreeterHandler registers the http handlers for service MyGreeter to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMyGreeterHandlerClient ¶
func RegisterMyGreeterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MyGreeterClient) error
RegisterMyGreeterHandlerClient registers the http handlers for service MyGreeter to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MyGreeterClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MyGreeterClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MyGreeterClient" to call the correct interceptors.
func RegisterMyGreeterHandlerFromEndpoint ¶
func RegisterMyGreeterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMyGreeterHandlerFromEndpoint is same as RegisterMyGreeterHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMyGreeterHandlerServer ¶
func RegisterMyGreeterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MyGreeterServer) error
RegisterMyGreeterHandlerServer registers the http handlers for service MyGreeter to "mux". UnaryRPC :call MyGreeterServer 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 RegisterMyGreeterHandlerFromEndpoint instead.
func RegisterMyGreeterServer ¶
func RegisterMyGreeterServer(s grpc.ServiceRegistrar, srv MyGreeterServer)
Types ¶
type Address ¶
type Address struct { City string `protobuf:"bytes,1,opt,name=city,proto3" json:"city,omitempty"` // The city name State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` // The state name Zipcode int32 `protobuf:"varint,3,opt,name=zipcode,proto3" json:"zipcode,omitempty"` // The zip code Street string `protobuf:"bytes,4,opt,name=street,proto3" json:"street,omitempty"` // The street name // contains filtered or unexported fields }
func (*Address) Descriptor
deprecated
func (*Address) GetZipcode ¶
func (*Address) ProtoMessage ¶
func (*Address) ProtoMessage()
func (*Address) ProtoReflect ¶
func (x *Address) ProtoReflect() protoreflect.Message
type HelloReply ¶
type HelloReply struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*HelloReply) Descriptor
deprecated
func (*HelloReply) Descriptor() ([]byte, []int)
Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
func (*HelloReply) GetMessage ¶
func (x *HelloReply) GetMessage() string
func (*HelloReply) ProtoMessage ¶
func (*HelloReply) ProtoMessage()
func (*HelloReply) ProtoReflect ¶
func (x *HelloReply) ProtoReflect() protoreflect.Message
func (*HelloReply) Reset ¶
func (x *HelloReply) Reset()
func (*HelloReply) String ¶
func (x *HelloReply) String() string
type HelloRequest ¶
type HelloRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` Address *Address `protobuf:"bytes,4,opt,name=address,proto3,oneof" json:"address,omitempty"` // contains filtered or unexported fields }
func (*HelloRequest) Descriptor
deprecated
func (*HelloRequest) Descriptor() ([]byte, []int)
Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
func (*HelloRequest) GetAddress ¶
func (x *HelloRequest) GetAddress() *Address
func (*HelloRequest) GetAge ¶
func (x *HelloRequest) GetAge() int32
func (*HelloRequest) GetEmail ¶
func (x *HelloRequest) GetEmail() string
func (*HelloRequest) GetName ¶
func (x *HelloRequest) GetName() string
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) ProtoReflect ¶
func (x *HelloRequest) ProtoReflect() protoreflect.Message
func (*HelloRequest) Reset ¶
func (x *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (x *HelloRequest) String() string
type MyGreeterClient ¶
type MyGreeterClient interface { // Sends a greeting SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) }
MyGreeterClient is the client API for MyGreeter 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.
func NewMyGreeterClient ¶
func NewMyGreeterClient(cc grpc.ClientConnInterface) MyGreeterClient
type MyGreeterServer ¶
type MyGreeterServer interface { // Sends a greeting SayHello(context.Context, *HelloRequest) (*HelloReply, error) // contains filtered or unexported methods }
MyGreeterServer is the server API for MyGreeter service. All implementations must embed UnimplementedMyGreeterServer for forward compatibility.
type UnimplementedMyGreeterServer ¶
type UnimplementedMyGreeterServer struct{}
UnimplementedMyGreeterServer 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 (UnimplementedMyGreeterServer) SayHello ¶
func (UnimplementedMyGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error)
type UnsafeMyGreeterServer ¶
type UnsafeMyGreeterServer interface {
// contains filtered or unexported methods
}
UnsafeMyGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MyGreeterServer will result in compilation errors.