Documentation ¶
Overview ¶
Package xxapi is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error
- func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error
- func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)
- type ApiServiceClient
- type ApiServiceServer
- type EmptyMessage
- type LoginReqMessage
- func (*LoginReqMessage) Descriptor() ([]byte, []int)deprecated
- func (x *LoginReqMessage) GetPasswdmd5() string
- func (x *LoginReqMessage) GetUsername() string
- func (*LoginReqMessage) ProtoMessage()
- func (x *LoginReqMessage) ProtoReflect() protoreflect.Message
- func (x *LoginReqMessage) Reset()
- func (x *LoginReqMessage) String() string
- type LoginRespMessage
- type StringMessage
- type UnimplementedApiServiceServer
- type UnsafeApiServiceServer
Constants ¶
This section is empty.
Variables ¶
var ApiService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "apiservice.ApiService", HandlerType: (*ApiServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Login", Handler: _ApiService_Login_Handler, }, { MethodName: "Echo", Handler: _ApiService_Echo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api.proto", }
ApiService_ServiceDesc is the grpc.ServiceDesc for ApiService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_api_proto protoreflect.FileDescriptor
Functions ¶
func RegisterApiServiceHandler ¶
func RegisterApiServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterApiServiceHandler registers the http handlers for service ApiService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterApiServiceHandlerClient ¶
func RegisterApiServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ApiServiceClient) error
RegisterApiServiceHandlerClient registers the http handlers for service ApiService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ApiServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ApiServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ApiServiceClient" to call the correct interceptors.
func RegisterApiServiceHandlerFromEndpoint ¶
func RegisterApiServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterApiServiceHandlerFromEndpoint is same as RegisterApiServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterApiServiceHandlerServer ¶
func RegisterApiServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ApiServiceServer) error
RegisterApiServiceHandlerServer registers the http handlers for service ApiService to "mux". UnaryRPC :call ApiServiceServer 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 RegisterApiServiceHandlerFromEndpoint instead.
func RegisterApiServiceServer ¶
func RegisterApiServiceServer(s grpc.ServiceRegistrar, srv ApiServiceServer)
Types ¶
type ApiServiceClient ¶
type ApiServiceClient interface { Login(ctx context.Context, in *LoginReqMessage, opts ...grpc.CallOption) (*LoginRespMessage, error) Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error) }
ApiServiceClient is the client API for ApiService 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 NewApiServiceClient ¶
func NewApiServiceClient(cc grpc.ClientConnInterface) ApiServiceClient
type ApiServiceServer ¶
type ApiServiceServer interface { Login(context.Context, *LoginReqMessage) (*LoginRespMessage, error) Echo(context.Context, *StringMessage) (*StringMessage, error) // contains filtered or unexported methods }
ApiServiceServer is the server API for ApiService service. All implementations must embed UnimplementedApiServiceServer for forward compatibility
type EmptyMessage ¶
type EmptyMessage struct {
// contains filtered or unexported fields
}
func (*EmptyMessage) Descriptor
deprecated
func (*EmptyMessage) Descriptor() ([]byte, []int)
Deprecated: Use EmptyMessage.ProtoReflect.Descriptor instead.
func (*EmptyMessage) ProtoMessage ¶
func (*EmptyMessage) ProtoMessage()
func (*EmptyMessage) ProtoReflect ¶
func (x *EmptyMessage) ProtoReflect() protoreflect.Message
func (*EmptyMessage) Reset ¶
func (x *EmptyMessage) Reset()
func (*EmptyMessage) String ¶
func (x *EmptyMessage) String() string
type LoginReqMessage ¶
type LoginReqMessage struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Passwdmd5 string `protobuf:"bytes,2,opt,name=passwdmd5,proto3" json:"passwdmd5,omitempty"` // contains filtered or unexported fields }
func (*LoginReqMessage) Descriptor
deprecated
func (*LoginReqMessage) Descriptor() ([]byte, []int)
Deprecated: Use LoginReqMessage.ProtoReflect.Descriptor instead.
func (*LoginReqMessage) GetPasswdmd5 ¶
func (x *LoginReqMessage) GetPasswdmd5() string
func (*LoginReqMessage) GetUsername ¶
func (x *LoginReqMessage) GetUsername() string
func (*LoginReqMessage) ProtoMessage ¶
func (*LoginReqMessage) ProtoMessage()
func (*LoginReqMessage) ProtoReflect ¶
func (x *LoginReqMessage) ProtoReflect() protoreflect.Message
func (*LoginReqMessage) Reset ¶
func (x *LoginReqMessage) Reset()
func (*LoginReqMessage) String ¶
func (x *LoginReqMessage) String() string
type LoginRespMessage ¶
type LoginRespMessage struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // contains filtered or unexported fields }
func (*LoginRespMessage) Descriptor
deprecated
func (*LoginRespMessage) Descriptor() ([]byte, []int)
Deprecated: Use LoginRespMessage.ProtoReflect.Descriptor instead.
func (*LoginRespMessage) GetToken ¶
func (x *LoginRespMessage) GetToken() string
func (*LoginRespMessage) ProtoMessage ¶
func (*LoginRespMessage) ProtoMessage()
func (*LoginRespMessage) ProtoReflect ¶
func (x *LoginRespMessage) ProtoReflect() protoreflect.Message
func (*LoginRespMessage) Reset ¶
func (x *LoginRespMessage) Reset()
func (*LoginRespMessage) String ¶
func (x *LoginRespMessage) String() string
type StringMessage ¶
type StringMessage struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*StringMessage) Descriptor
deprecated
func (*StringMessage) Descriptor() ([]byte, []int)
Deprecated: Use StringMessage.ProtoReflect.Descriptor instead.
func (*StringMessage) GetValue ¶
func (x *StringMessage) GetValue() string
func (*StringMessage) ProtoMessage ¶
func (*StringMessage) ProtoMessage()
func (*StringMessage) ProtoReflect ¶
func (x *StringMessage) ProtoReflect() protoreflect.Message
func (*StringMessage) Reset ¶
func (x *StringMessage) Reset()
func (*StringMessage) String ¶
func (x *StringMessage) String() string
type UnimplementedApiServiceServer ¶
type UnimplementedApiServiceServer struct { }
UnimplementedApiServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedApiServiceServer) Echo ¶
func (UnimplementedApiServiceServer) Echo(context.Context, *StringMessage) (*StringMessage, error)
func (UnimplementedApiServiceServer) Login ¶
func (UnimplementedApiServiceServer) Login(context.Context, *LoginReqMessage) (*LoginRespMessage, error)
type UnsafeApiServiceServer ¶
type UnsafeApiServiceServer interface {
// contains filtered or unexported methods
}
UnsafeApiServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ApiServiceServer will result in compilation errors.