Documentation ¶
Overview ¶
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
- func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
- func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
- type AuthenticationResponse
- func (*AuthenticationResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AuthenticationResponse) GetToken() string
- func (x *AuthenticationResponse) GetUser() *UserResponse
- func (*AuthenticationResponse) ProtoMessage()
- func (x *AuthenticationResponse) ProtoReflect() protoreflect.Message
- func (x *AuthenticationResponse) Reset()
- func (x *AuthenticationResponse) String() string
- func (m *AuthenticationResponse) Validate() error
- type AuthenticationResponseValidationError
- func (e AuthenticationResponseValidationError) Cause() error
- func (e AuthenticationResponseValidationError) Error() string
- func (e AuthenticationResponseValidationError) ErrorName() string
- func (e AuthenticationResponseValidationError) Field() string
- func (e AuthenticationResponseValidationError) Key() bool
- func (e AuthenticationResponseValidationError) Reason() string
- type Empty
- type EmptyValidationError
- type LoginRequest
- func (*LoginRequest) Descriptor() ([]byte, []int)deprecated
- func (x *LoginRequest) GetEmail() string
- func (x *LoginRequest) GetPassword() string
- func (*LoginRequest) ProtoMessage()
- func (x *LoginRequest) ProtoReflect() protoreflect.Message
- func (x *LoginRequest) Reset()
- func (x *LoginRequest) String() string
- func (m *LoginRequest) Validate() error
- type LoginRequestValidationError
- func (e LoginRequestValidationError) Cause() error
- func (e LoginRequestValidationError) Error() string
- func (e LoginRequestValidationError) ErrorName() string
- func (e LoginRequestValidationError) Field() string
- func (e LoginRequestValidationError) Key() bool
- func (e LoginRequestValidationError) Reason() string
- type RegistrationRequest
- func (*RegistrationRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RegistrationRequest) GetEmail() string
- func (x *RegistrationRequest) GetPassword() string
- func (*RegistrationRequest) ProtoMessage()
- func (x *RegistrationRequest) ProtoReflect() protoreflect.Message
- func (x *RegistrationRequest) Reset()
- func (x *RegistrationRequest) String() string
- func (m *RegistrationRequest) Validate() error
- type RegistrationRequestValidationError
- func (e RegistrationRequestValidationError) Cause() error
- func (e RegistrationRequestValidationError) Error() string
- func (e RegistrationRequestValidationError) ErrorName() string
- func (e RegistrationRequestValidationError) Field() string
- func (e RegistrationRequestValidationError) Key() bool
- func (e RegistrationRequestValidationError) Reason() string
- type UnimplementedUserServiceServer
- func (UnimplementedUserServiceServer) GetCurrent(context.Context, *Empty) (*UserResponse, error)
- func (UnimplementedUserServiceServer) Login(context.Context, *LoginRequest) (*AuthenticationResponse, error)
- func (UnimplementedUserServiceServer) Register(context.Context, *RegistrationRequest) (*AuthenticationResponse, error)
- type UnsafeUserServiceServer
- type UserResponse
- func (*UserResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UserResponse) GetEmail() string
- func (*UserResponse) ProtoMessage()
- func (x *UserResponse) ProtoReflect() protoreflect.Message
- func (x *UserResponse) Reset()
- func (x *UserResponse) String() string
- func (m *UserResponse) Validate() error
- type UserResponseValidationError
- func (e UserResponseValidationError) Cause() error
- func (e UserResponseValidationError) Error() string
- func (e UserResponseValidationError) ErrorName() string
- func (e UserResponseValidationError) Field() string
- func (e UserResponseValidationError) Key() bool
- func (e UserResponseValidationError) Reason() string
- type UserServiceClient
- type UserServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_v1_users_proto protoreflect.FileDescriptor
var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "users.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Register", Handler: _UserService_Register_Handler, }, { MethodName: "Login", Handler: _UserService_Login_Handler, }, { MethodName: "GetCurrent", Handler: _UserService_GetCurrent_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "v1/users.proto", }
UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserServiceHandler ¶
func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserServiceHandler registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandlerClient ¶
func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
RegisterUserServiceHandlerClient registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerFromEndpoint ¶
func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceHandlerServer ¶
func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". UnaryRPC :call UserServiceServer 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 RegisterUserServiceHandlerFromEndpoint instead.
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
Types ¶
type AuthenticationResponse ¶
type AuthenticationResponse struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` User *UserResponse `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` // contains filtered or unexported fields }
func (*AuthenticationResponse) Descriptor
deprecated
func (*AuthenticationResponse) Descriptor() ([]byte, []int)
Deprecated: Use AuthenticationResponse.ProtoReflect.Descriptor instead.
func (*AuthenticationResponse) GetToken ¶
func (x *AuthenticationResponse) GetToken() string
func (*AuthenticationResponse) GetUser ¶
func (x *AuthenticationResponse) GetUser() *UserResponse
func (*AuthenticationResponse) ProtoMessage ¶
func (*AuthenticationResponse) ProtoMessage()
func (*AuthenticationResponse) ProtoReflect ¶
func (x *AuthenticationResponse) ProtoReflect() protoreflect.Message
func (*AuthenticationResponse) Reset ¶
func (x *AuthenticationResponse) Reset()
func (*AuthenticationResponse) String ¶
func (x *AuthenticationResponse) String() string
func (*AuthenticationResponse) Validate ¶
func (m *AuthenticationResponse) Validate() error
Validate checks the field values on AuthenticationResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
type AuthenticationResponseValidationError ¶
type AuthenticationResponseValidationError struct {
// contains filtered or unexported fields
}
AuthenticationResponseValidationError is the validation error returned by AuthenticationResponse.Validate if the designated constraints aren't met.
func (AuthenticationResponseValidationError) Cause ¶
func (e AuthenticationResponseValidationError) Cause() error
Cause function returns cause value.
func (AuthenticationResponseValidationError) Error ¶
func (e AuthenticationResponseValidationError) Error() string
Error satisfies the builtin error interface
func (AuthenticationResponseValidationError) ErrorName ¶
func (e AuthenticationResponseValidationError) ErrorName() string
ErrorName returns error name.
func (AuthenticationResponseValidationError) Field ¶
func (e AuthenticationResponseValidationError) Field() string
Field function returns field value.
func (AuthenticationResponseValidationError) Key ¶
func (e AuthenticationResponseValidationError) Key() bool
Key function returns key value.
func (AuthenticationResponseValidationError) Reason ¶
func (e AuthenticationResponseValidationError) Reason() string
Reason function returns reason value.
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type EmptyValidationError ¶
type EmptyValidationError struct {
// contains filtered or unexported fields
}
EmptyValidationError is the validation error returned by Empty.Validate if the designated constraints aren't met.
func (EmptyValidationError) Cause ¶
func (e EmptyValidationError) Cause() error
Cause function returns cause value.
func (EmptyValidationError) Error ¶
func (e EmptyValidationError) Error() string
Error satisfies the builtin error interface
func (EmptyValidationError) ErrorName ¶
func (e EmptyValidationError) ErrorName() string
ErrorName returns error name.
func (EmptyValidationError) Field ¶
func (e EmptyValidationError) Field() string
Field function returns field value.
func (EmptyValidationError) Key ¶
func (e EmptyValidationError) Key() bool
Key function returns key value.
func (EmptyValidationError) Reason ¶
func (e EmptyValidationError) Reason() string
Reason function returns reason value.
type LoginRequest ¶
type LoginRequest struct { Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*LoginRequest) Descriptor
deprecated
func (*LoginRequest) Descriptor() ([]byte, []int)
Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.
func (*LoginRequest) GetEmail ¶
func (x *LoginRequest) GetEmail() string
func (*LoginRequest) GetPassword ¶
func (x *LoginRequest) GetPassword() string
func (*LoginRequest) ProtoMessage ¶
func (*LoginRequest) ProtoMessage()
func (*LoginRequest) ProtoReflect ¶
func (x *LoginRequest) ProtoReflect() protoreflect.Message
func (*LoginRequest) Reset ¶
func (x *LoginRequest) Reset()
func (*LoginRequest) String ¶
func (x *LoginRequest) String() string
func (*LoginRequest) Validate ¶
func (m *LoginRequest) Validate() error
Validate checks the field values on LoginRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
type LoginRequestValidationError ¶
type LoginRequestValidationError struct {
// contains filtered or unexported fields
}
LoginRequestValidationError is the validation error returned by LoginRequest.Validate if the designated constraints aren't met.
func (LoginRequestValidationError) Cause ¶
func (e LoginRequestValidationError) Cause() error
Cause function returns cause value.
func (LoginRequestValidationError) Error ¶
func (e LoginRequestValidationError) Error() string
Error satisfies the builtin error interface
func (LoginRequestValidationError) ErrorName ¶
func (e LoginRequestValidationError) ErrorName() string
ErrorName returns error name.
func (LoginRequestValidationError) Field ¶
func (e LoginRequestValidationError) Field() string
Field function returns field value.
func (LoginRequestValidationError) Key ¶
func (e LoginRequestValidationError) Key() bool
Key function returns key value.
func (LoginRequestValidationError) Reason ¶
func (e LoginRequestValidationError) Reason() string
Reason function returns reason value.
type RegistrationRequest ¶
type RegistrationRequest struct { Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*RegistrationRequest) Descriptor
deprecated
func (*RegistrationRequest) Descriptor() ([]byte, []int)
Deprecated: Use RegistrationRequest.ProtoReflect.Descriptor instead.
func (*RegistrationRequest) GetEmail ¶
func (x *RegistrationRequest) GetEmail() string
func (*RegistrationRequest) GetPassword ¶
func (x *RegistrationRequest) GetPassword() string
func (*RegistrationRequest) ProtoMessage ¶
func (*RegistrationRequest) ProtoMessage()
func (*RegistrationRequest) ProtoReflect ¶
func (x *RegistrationRequest) ProtoReflect() protoreflect.Message
func (*RegistrationRequest) Reset ¶
func (x *RegistrationRequest) Reset()
func (*RegistrationRequest) String ¶
func (x *RegistrationRequest) String() string
func (*RegistrationRequest) Validate ¶
func (m *RegistrationRequest) Validate() error
Validate checks the field values on RegistrationRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
type RegistrationRequestValidationError ¶
type RegistrationRequestValidationError struct {
// contains filtered or unexported fields
}
RegistrationRequestValidationError is the validation error returned by RegistrationRequest.Validate if the designated constraints aren't met.
func (RegistrationRequestValidationError) Cause ¶
func (e RegistrationRequestValidationError) Cause() error
Cause function returns cause value.
func (RegistrationRequestValidationError) Error ¶
func (e RegistrationRequestValidationError) Error() string
Error satisfies the builtin error interface
func (RegistrationRequestValidationError) ErrorName ¶
func (e RegistrationRequestValidationError) ErrorName() string
ErrorName returns error name.
func (RegistrationRequestValidationError) Field ¶
func (e RegistrationRequestValidationError) Field() string
Field function returns field value.
func (RegistrationRequestValidationError) Key ¶
func (e RegistrationRequestValidationError) Key() bool
Key function returns key value.
func (RegistrationRequestValidationError) Reason ¶
func (e RegistrationRequestValidationError) Reason() string
Reason function returns reason value.
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedUserServiceServer) GetCurrent ¶
func (UnimplementedUserServiceServer) GetCurrent(context.Context, *Empty) (*UserResponse, error)
func (UnimplementedUserServiceServer) Login ¶
func (UnimplementedUserServiceServer) Login(context.Context, *LoginRequest) (*AuthenticationResponse, error)
func (UnimplementedUserServiceServer) Register ¶
func (UnimplementedUserServiceServer) Register(context.Context, *RegistrationRequest) (*AuthenticationResponse, error)
type UnsafeUserServiceServer ¶
type UnsafeUserServiceServer interface {
// contains filtered or unexported methods
}
UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserServiceServer will result in compilation errors.
type UserResponse ¶
type UserResponse struct { Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"` // contains filtered or unexported fields }
func (*UserResponse) Descriptor
deprecated
func (*UserResponse) Descriptor() ([]byte, []int)
Deprecated: Use UserResponse.ProtoReflect.Descriptor instead.
func (*UserResponse) GetEmail ¶
func (x *UserResponse) GetEmail() string
func (*UserResponse) ProtoMessage ¶
func (*UserResponse) ProtoMessage()
func (*UserResponse) ProtoReflect ¶
func (x *UserResponse) ProtoReflect() protoreflect.Message
func (*UserResponse) Reset ¶
func (x *UserResponse) Reset()
func (*UserResponse) String ¶
func (x *UserResponse) String() string
func (*UserResponse) Validate ¶
func (m *UserResponse) Validate() error
Validate checks the field values on UserResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
type UserResponseValidationError ¶
type UserResponseValidationError struct {
// contains filtered or unexported fields
}
UserResponseValidationError is the validation error returned by UserResponse.Validate if the designated constraints aren't met.
func (UserResponseValidationError) Cause ¶
func (e UserResponseValidationError) Cause() error
Cause function returns cause value.
func (UserResponseValidationError) Error ¶
func (e UserResponseValidationError) Error() string
Error satisfies the builtin error interface
func (UserResponseValidationError) ErrorName ¶
func (e UserResponseValidationError) ErrorName() string
ErrorName returns error name.
func (UserResponseValidationError) Field ¶
func (e UserResponseValidationError) Field() string
Field function returns field value.
func (UserResponseValidationError) Key ¶
func (e UserResponseValidationError) Key() bool
Key function returns key value.
func (UserResponseValidationError) Reason ¶
func (e UserResponseValidationError) Reason() string
Reason function returns reason value.
type UserServiceClient ¶
type UserServiceClient interface { Register(ctx context.Context, in *RegistrationRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error) GetCurrent(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserResponse, error) }
UserServiceClient is the client API for UserService 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 NewUserServiceClient ¶
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { Register(context.Context, *RegistrationRequest) (*AuthenticationResponse, error) Login(context.Context, *LoginRequest) (*AuthenticationResponse, error) GetCurrent(context.Context, *Empty) (*UserResponse, error) // contains filtered or unexported methods }
UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility