Documentation
¶
Overview ¶
Package words is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterWordsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterWordsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WordsServiceClient) error
- func RegisterWordsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterWordsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WordsServiceServer) error
- func RegisterWordsServiceServer(s grpc.ServiceRegistrar, srv WordsServiceServer)
- type AddWordRequest
- type AddWordResponse
- func (*AddWordResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AddWordResponse) GetId() int64
- func (x *AddWordResponse) GetWord() string
- func (*AddWordResponse) ProtoMessage()
- func (x *AddWordResponse) ProtoReflect() protoreflect.Message
- func (x *AddWordResponse) Reset()
- func (x *AddWordResponse) String() string
- type HealthCheckRequest
- type HealthCheckResponse
- type RandomWordRequest
- type RandomWordResponse
- func (*RandomWordResponse) Descriptor() ([]byte, []int)deprecated
- func (x *RandomWordResponse) GetId() int64
- func (x *RandomWordResponse) GetWord() string
- func (*RandomWordResponse) ProtoMessage()
- func (x *RandomWordResponse) ProtoReflect() protoreflect.Message
- func (x *RandomWordResponse) Reset()
- func (x *RandomWordResponse) String() string
- type SearchWordRequest
- type SearchWordResponse
- func (*SearchWordResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SearchWordResponse) GetWords() []string
- func (*SearchWordResponse) ProtoMessage()
- func (x *SearchWordResponse) ProtoReflect() protoreflect.Message
- func (x *SearchWordResponse) Reset()
- func (x *SearchWordResponse) String() string
- type UnimplementedWordsServiceServer
- func (UnimplementedWordsServiceServer) AddWord(context.Context, *AddWordRequest) (*AddWordResponse, error)
- func (UnimplementedWordsServiceServer) RandomWord(context.Context, *RandomWordRequest) (*RandomWordResponse, error)
- func (UnimplementedWordsServiceServer) SearchWord(context.Context, *SearchWordRequest) (*SearchWordResponse, error)
- type UnsafeWordsServiceServer
- type WordsServiceClient
- type WordsServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_words_words_proto protoreflect.FileDescriptor
var WordsService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "words.WordsService", HandlerType: (*WordsServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddWord", Handler: _WordsService_AddWord_Handler, }, { MethodName: "RandomWord", Handler: _WordsService_RandomWord_Handler, }, { MethodName: "SearchWord", Handler: _WordsService_SearchWord_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "words/words.proto", }
WordsService_ServiceDesc is the grpc.ServiceDesc for WordsService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterWordsServiceHandler ¶
func RegisterWordsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterWordsServiceHandler registers the http handlers for service WordsService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterWordsServiceHandlerClient ¶
func RegisterWordsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WordsServiceClient) error
RegisterWordsServiceHandlerClient registers the http handlers for service WordsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WordsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WordsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "WordsServiceClient" to call the correct interceptors.
func RegisterWordsServiceHandlerFromEndpoint ¶
func RegisterWordsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterWordsServiceHandlerFromEndpoint is same as RegisterWordsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterWordsServiceHandlerServer ¶
func RegisterWordsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WordsServiceServer) error
RegisterWordsServiceHandlerServer registers the http handlers for service WordsService to "mux". UnaryRPC :call WordsServiceServer 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 RegisterWordsServiceHandlerFromEndpoint instead.
func RegisterWordsServiceServer ¶
func RegisterWordsServiceServer(s grpc.ServiceRegistrar, srv WordsServiceServer)
Types ¶
type AddWordRequest ¶
type AddWordRequest struct { Word string `protobuf:"bytes,1,opt,name=word,proto3" json:"word,omitempty"` // contains filtered or unexported fields }
func (*AddWordRequest) Descriptor
deprecated
func (*AddWordRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddWordRequest.ProtoReflect.Descriptor instead.
func (*AddWordRequest) GetWord ¶
func (x *AddWordRequest) GetWord() string
func (*AddWordRequest) ProtoMessage ¶
func (*AddWordRequest) ProtoMessage()
func (*AddWordRequest) ProtoReflect ¶
func (x *AddWordRequest) ProtoReflect() protoreflect.Message
func (*AddWordRequest) Reset ¶
func (x *AddWordRequest) Reset()
func (*AddWordRequest) String ¶
func (x *AddWordRequest) String() string
type AddWordResponse ¶
type AddWordResponse struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Word string `protobuf:"bytes,2,opt,name=word,proto3" json:"word,omitempty"` // contains filtered or unexported fields }
func (*AddWordResponse) Descriptor
deprecated
func (*AddWordResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddWordResponse.ProtoReflect.Descriptor instead.
func (*AddWordResponse) GetId ¶
func (x *AddWordResponse) GetId() int64
func (*AddWordResponse) GetWord ¶
func (x *AddWordResponse) GetWord() string
func (*AddWordResponse) ProtoMessage ¶
func (*AddWordResponse) ProtoMessage()
func (*AddWordResponse) ProtoReflect ¶
func (x *AddWordResponse) ProtoReflect() protoreflect.Message
func (*AddWordResponse) Reset ¶
func (x *AddWordResponse) Reset()
func (*AddWordResponse) String ¶
func (x *AddWordResponse) String() string
type HealthCheckRequest ¶
type HealthCheckRequest struct {
// contains filtered or unexported fields
}
func (*HealthCheckRequest) Descriptor
deprecated
func (*HealthCheckRequest) Descriptor() ([]byte, []int)
Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
func (*HealthCheckRequest) ProtoMessage ¶
func (*HealthCheckRequest) ProtoMessage()
func (*HealthCheckRequest) ProtoReflect ¶
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message
func (*HealthCheckRequest) Reset ¶
func (x *HealthCheckRequest) Reset()
func (*HealthCheckRequest) String ¶
func (x *HealthCheckRequest) String() string
type HealthCheckResponse ¶
type HealthCheckResponse struct {
// contains filtered or unexported fields
}
func (*HealthCheckResponse) Descriptor
deprecated
func (*HealthCheckResponse) Descriptor() ([]byte, []int)
Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
func (*HealthCheckResponse) ProtoMessage ¶
func (*HealthCheckResponse) ProtoMessage()
func (*HealthCheckResponse) ProtoReflect ¶
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message
func (*HealthCheckResponse) Reset ¶
func (x *HealthCheckResponse) Reset()
func (*HealthCheckResponse) String ¶
func (x *HealthCheckResponse) String() string
type RandomWordRequest ¶
type RandomWordRequest struct {
// contains filtered or unexported fields
}
func (*RandomWordRequest) Descriptor
deprecated
func (*RandomWordRequest) Descriptor() ([]byte, []int)
Deprecated: Use RandomWordRequest.ProtoReflect.Descriptor instead.
func (*RandomWordRequest) ProtoMessage ¶
func (*RandomWordRequest) ProtoMessage()
func (*RandomWordRequest) ProtoReflect ¶
func (x *RandomWordRequest) ProtoReflect() protoreflect.Message
func (*RandomWordRequest) Reset ¶
func (x *RandomWordRequest) Reset()
func (*RandomWordRequest) String ¶
func (x *RandomWordRequest) String() string
type RandomWordResponse ¶
type RandomWordResponse struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Word string `protobuf:"bytes,2,opt,name=word,proto3" json:"word,omitempty"` // contains filtered or unexported fields }
func (*RandomWordResponse) Descriptor
deprecated
func (*RandomWordResponse) Descriptor() ([]byte, []int)
Deprecated: Use RandomWordResponse.ProtoReflect.Descriptor instead.
func (*RandomWordResponse) GetId ¶
func (x *RandomWordResponse) GetId() int64
func (*RandomWordResponse) GetWord ¶
func (x *RandomWordResponse) GetWord() string
func (*RandomWordResponse) ProtoMessage ¶
func (*RandomWordResponse) ProtoMessage()
func (*RandomWordResponse) ProtoReflect ¶
func (x *RandomWordResponse) ProtoReflect() protoreflect.Message
func (*RandomWordResponse) Reset ¶
func (x *RandomWordResponse) Reset()
func (*RandomWordResponse) String ¶
func (x *RandomWordResponse) String() string
type SearchWordRequest ¶
type SearchWordRequest struct { Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // contains filtered or unexported fields }
func (*SearchWordRequest) Descriptor
deprecated
func (*SearchWordRequest) Descriptor() ([]byte, []int)
Deprecated: Use SearchWordRequest.ProtoReflect.Descriptor instead.
func (*SearchWordRequest) GetQuery ¶
func (x *SearchWordRequest) GetQuery() string
func (*SearchWordRequest) ProtoMessage ¶
func (*SearchWordRequest) ProtoMessage()
func (*SearchWordRequest) ProtoReflect ¶
func (x *SearchWordRequest) ProtoReflect() protoreflect.Message
func (*SearchWordRequest) Reset ¶
func (x *SearchWordRequest) Reset()
func (*SearchWordRequest) String ¶
func (x *SearchWordRequest) String() string
type SearchWordResponse ¶
type SearchWordResponse struct { Words []string `protobuf:"bytes,1,rep,name=words,proto3" json:"words,omitempty"` // contains filtered or unexported fields }
func (*SearchWordResponse) Descriptor
deprecated
func (*SearchWordResponse) Descriptor() ([]byte, []int)
Deprecated: Use SearchWordResponse.ProtoReflect.Descriptor instead.
func (*SearchWordResponse) GetWords ¶
func (x *SearchWordResponse) GetWords() []string
func (*SearchWordResponse) ProtoMessage ¶
func (*SearchWordResponse) ProtoMessage()
func (*SearchWordResponse) ProtoReflect ¶
func (x *SearchWordResponse) ProtoReflect() protoreflect.Message
func (*SearchWordResponse) Reset ¶
func (x *SearchWordResponse) Reset()
func (*SearchWordResponse) String ¶
func (x *SearchWordResponse) String() string
type UnimplementedWordsServiceServer ¶
type UnimplementedWordsServiceServer struct { }
UnimplementedWordsServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedWordsServiceServer) AddWord ¶
func (UnimplementedWordsServiceServer) AddWord(context.Context, *AddWordRequest) (*AddWordResponse, error)
func (UnimplementedWordsServiceServer) RandomWord ¶
func (UnimplementedWordsServiceServer) RandomWord(context.Context, *RandomWordRequest) (*RandomWordResponse, error)
func (UnimplementedWordsServiceServer) SearchWord ¶
func (UnimplementedWordsServiceServer) SearchWord(context.Context, *SearchWordRequest) (*SearchWordResponse, error)
type UnsafeWordsServiceServer ¶
type UnsafeWordsServiceServer interface {
// contains filtered or unexported methods
}
UnsafeWordsServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WordsServiceServer will result in compilation errors.
type WordsServiceClient ¶
type WordsServiceClient interface { AddWord(ctx context.Context, in *AddWordRequest, opts ...grpc.CallOption) (*AddWordResponse, error) RandomWord(ctx context.Context, in *RandomWordRequest, opts ...grpc.CallOption) (*RandomWordResponse, error) SearchWord(ctx context.Context, in *SearchWordRequest, opts ...grpc.CallOption) (*SearchWordResponse, error) }
WordsServiceClient is the client API for WordsService 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 NewWordsServiceClient ¶
func NewWordsServiceClient(cc grpc.ClientConnInterface) WordsServiceClient
type WordsServiceServer ¶
type WordsServiceServer interface { AddWord(context.Context, *AddWordRequest) (*AddWordResponse, error) RandomWord(context.Context, *RandomWordRequest) (*RandomWordResponse, error) SearchWord(context.Context, *SearchWordRequest) (*SearchWordResponse, error) }
WordsServiceServer is the server API for WordsService service. All implementations should embed UnimplementedWordsServiceServer for forward compatibility