Documentation ¶
Overview ¶
Package service is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterUserHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserClient) error
- func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServer) error
- func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer)
- type UnimplementedUserServer
- type UnsafeUserServer
- type UserClient
- type UserLoginRequest
- func (*UserLoginRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UserLoginRequest) GetEmail() string
- func (x *UserLoginRequest) GetPassword() string
- func (*UserLoginRequest) ProtoMessage()
- func (x *UserLoginRequest) ProtoReflect() protoreflect.Message
- func (x *UserLoginRequest) Reset()
- func (x *UserLoginRequest) String() string
- type UserLoginResponse
- func (*UserLoginResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UserLoginResponse) GetStatus() string
- func (x *UserLoginResponse) GetUserId() string
- func (*UserLoginResponse) ProtoMessage()
- func (x *UserLoginResponse) ProtoReflect() protoreflect.Message
- func (x *UserLoginResponse) Reset()
- func (x *UserLoginResponse) String() string
- type UserRegisterReponse
- func (*UserRegisterReponse) Descriptor() ([]byte, []int)deprecated
- func (x *UserRegisterReponse) GetStatus() string
- func (x *UserRegisterReponse) GetUserId() string
- func (*UserRegisterReponse) ProtoMessage()
- func (x *UserRegisterReponse) ProtoReflect() protoreflect.Message
- func (x *UserRegisterReponse) Reset()
- func (x *UserRegisterReponse) String() string
- type UserRegisterRequest
- func (*UserRegisterRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UserRegisterRequest) GetEmail() string
- func (x *UserRegisterRequest) GetName() string
- func (x *UserRegisterRequest) GetPassword() string
- func (*UserRegisterRequest) ProtoMessage()
- func (x *UserRegisterRequest) ProtoReflect() protoreflect.Message
- func (x *UserRegisterRequest) Reset()
- func (x *UserRegisterRequest) String() string
- type UserServer
Constants ¶
const ( User_RegisterUser_FullMethodName = "/service.User/RegisterUser" User_LoginUser_FullMethodName = "/service.User/LoginUser" )
Variables ¶
var File_service_user_proto protoreflect.FileDescriptor
var User_ServiceDesc = grpc.ServiceDesc{ ServiceName: "service.User", HandlerType: (*UserServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "RegisterUser", Handler: _User_RegisterUser_Handler, }, { MethodName: "LoginUser", Handler: _User_LoginUser_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "service/user.proto", }
User_ServiceDesc is the grpc.ServiceDesc for User service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserHandler ¶
RegisterUserHandler registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserHandlerClient ¶
RegisterUserHandlerClient registers the http handlers for service User to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserClient" to call the correct interceptors.
func RegisterUserHandlerFromEndpoint ¶
func RegisterUserHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserHandlerFromEndpoint is same as RegisterUserHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserHandlerServer ¶
RegisterUserHandlerServer registers the http handlers for service User to "mux". UnaryRPC :call UserServer 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 RegisterUserHandlerFromEndpoint instead.
func RegisterUserServer ¶
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer)
Types ¶
type UnimplementedUserServer ¶
type UnimplementedUserServer struct { }
UnimplementedUserServer must be embedded to have forward compatible implementations.
func (UnimplementedUserServer) LoginUser ¶
func (UnimplementedUserServer) LoginUser(context.Context, *UserLoginRequest) (*UserLoginResponse, error)
func (UnimplementedUserServer) RegisterUser ¶
func (UnimplementedUserServer) RegisterUser(context.Context, *UserRegisterRequest) (*UserRegisterReponse, error)
type UnsafeUserServer ¶
type UnsafeUserServer interface {
// contains filtered or unexported methods
}
UnsafeUserServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserServer will result in compilation errors.
type UserClient ¶
type UserClient interface { RegisterUser(ctx context.Context, in *UserRegisterRequest, opts ...grpc.CallOption) (*UserRegisterReponse, error) LoginUser(ctx context.Context, in *UserLoginRequest, opts ...grpc.CallOption) (*UserLoginResponse, error) }
UserClient is the client API for User 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 NewUserClient ¶
func NewUserClient(cc grpc.ClientConnInterface) UserClient
type UserLoginRequest ¶
type UserLoginRequest struct { Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*UserLoginRequest) Descriptor
deprecated
func (*UserLoginRequest) Descriptor() ([]byte, []int)
Deprecated: Use UserLoginRequest.ProtoReflect.Descriptor instead.
func (*UserLoginRequest) GetEmail ¶
func (x *UserLoginRequest) GetEmail() string
func (*UserLoginRequest) GetPassword ¶
func (x *UserLoginRequest) GetPassword() string
func (*UserLoginRequest) ProtoMessage ¶
func (*UserLoginRequest) ProtoMessage()
func (*UserLoginRequest) ProtoReflect ¶
func (x *UserLoginRequest) ProtoReflect() protoreflect.Message
func (*UserLoginRequest) Reset ¶
func (x *UserLoginRequest) Reset()
func (*UserLoginRequest) String ¶
func (x *UserLoginRequest) String() string
type UserLoginResponse ¶
type UserLoginResponse struct { Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` // contains filtered or unexported fields }
func (*UserLoginResponse) Descriptor
deprecated
func (*UserLoginResponse) Descriptor() ([]byte, []int)
Deprecated: Use UserLoginResponse.ProtoReflect.Descriptor instead.
func (*UserLoginResponse) GetStatus ¶
func (x *UserLoginResponse) GetStatus() string
func (*UserLoginResponse) GetUserId ¶
func (x *UserLoginResponse) GetUserId() string
func (*UserLoginResponse) ProtoMessage ¶
func (*UserLoginResponse) ProtoMessage()
func (*UserLoginResponse) ProtoReflect ¶
func (x *UserLoginResponse) ProtoReflect() protoreflect.Message
func (*UserLoginResponse) Reset ¶
func (x *UserLoginResponse) Reset()
func (*UserLoginResponse) String ¶
func (x *UserLoginResponse) String() string
type UserRegisterReponse ¶
type UserRegisterReponse struct { Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` // contains filtered or unexported fields }
func (*UserRegisterReponse) Descriptor
deprecated
func (*UserRegisterReponse) Descriptor() ([]byte, []int)
Deprecated: Use UserRegisterReponse.ProtoReflect.Descriptor instead.
func (*UserRegisterReponse) GetStatus ¶
func (x *UserRegisterReponse) GetStatus() string
func (*UserRegisterReponse) GetUserId ¶
func (x *UserRegisterReponse) GetUserId() string
func (*UserRegisterReponse) ProtoMessage ¶
func (*UserRegisterReponse) ProtoMessage()
func (*UserRegisterReponse) ProtoReflect ¶
func (x *UserRegisterReponse) ProtoReflect() protoreflect.Message
func (*UserRegisterReponse) Reset ¶
func (x *UserRegisterReponse) Reset()
func (*UserRegisterReponse) String ¶
func (x *UserRegisterReponse) String() string
type UserRegisterRequest ¶
type UserRegisterRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*UserRegisterRequest) Descriptor
deprecated
func (*UserRegisterRequest) Descriptor() ([]byte, []int)
Deprecated: Use UserRegisterRequest.ProtoReflect.Descriptor instead.
func (*UserRegisterRequest) GetEmail ¶
func (x *UserRegisterRequest) GetEmail() string
func (*UserRegisterRequest) GetName ¶
func (x *UserRegisterRequest) GetName() string
func (*UserRegisterRequest) GetPassword ¶
func (x *UserRegisterRequest) GetPassword() string
func (*UserRegisterRequest) ProtoMessage ¶
func (*UserRegisterRequest) ProtoMessage()
func (*UserRegisterRequest) ProtoReflect ¶
func (x *UserRegisterRequest) ProtoReflect() protoreflect.Message
func (*UserRegisterRequest) Reset ¶
func (x *UserRegisterRequest) Reset()
func (*UserRegisterRequest) String ¶
func (x *UserRegisterRequest) String() string
type UserServer ¶
type UserServer interface { RegisterUser(context.Context, *UserRegisterRequest) (*UserRegisterReponse, error) LoginUser(context.Context, *UserLoginRequest) (*UserLoginResponse, error) // contains filtered or unexported methods }
UserServer is the server API for User service. All implementations must embed UnimplementedUserServer for forward compatibility