Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorUserNotFound(format string, args ...interface{}) *errors.Error
- func InternalError(format string, args ...interface{}) *errors.Error
- func IsInternalError(err error) bool
- func IsUserAuthError(err error) bool
- func IsUserNotFound(err error) bool
- func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer)
- func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
- func UserAuthError(format string, args ...interface{}) *errors.Error
- type AuthReply
- type AuthRequest
- func (*AuthRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AuthRequest) GetPassword() string
- func (x *AuthRequest) GetUsername() string
- func (*AuthRequest) ProtoMessage()
- func (x *AuthRequest) ProtoReflect() protoreflect.Message
- func (x *AuthRequest) Reset()
- func (x *AuthRequest) String() string
- type ErrorReason
- func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
- func (x ErrorReason) Enum() *ErrorReason
- func (ErrorReason) EnumDescriptor() ([]byte, []int)deprecated
- func (x ErrorReason) Number() protoreflect.EnumNumber
- func (x ErrorReason) String() string
- func (ErrorReason) Type() protoreflect.EnumType
- type GetIdByTokenReply
- type GetIdByTokenReq
- type GreeterClient
- type GreeterHTTPClient
- type GreeterHTTPClientImpl
- func (c *GreeterHTTPClientImpl) GetIdByToken(ctx context.Context, in *GetIdByTokenReq, opts ...http.CallOption) (*GetIdByTokenReply, error)
- func (c *GreeterHTTPClientImpl) Login(ctx context.Context, in *AuthRequest, opts ...http.CallOption) (*AuthReply, error)
- func (c *GreeterHTTPClientImpl) Register(ctx context.Context, in *RegisterRequest, opts ...http.CallOption) (*emptypb.Empty, error)
- func (c *GreeterHTTPClientImpl) UpdateUserInfo(ctx context.Context, in *UpdateUserReq, opts ...http.CallOption) (*emptypb.Empty, error)
- type GreeterHTTPServer
- type GreeterServer
- type RegisterRequest
- func (*RegisterRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RegisterRequest) GetAvatar() string
- func (x *RegisterRequest) GetEmail() string
- func (x *RegisterRequest) GetPassword() string
- func (x *RegisterRequest) GetUsername() string
- func (*RegisterRequest) ProtoMessage()
- func (x *RegisterRequest) ProtoReflect() protoreflect.Message
- func (x *RegisterRequest) Reset()
- func (x *RegisterRequest) String() string
- type UnimplementedGreeterServer
- func (UnimplementedGreeterServer) GetIdByToken(context.Context, *GetIdByTokenReq) (*GetIdByTokenReply, error)
- func (UnimplementedGreeterServer) Login(context.Context, *AuthRequest) (*AuthReply, error)
- func (UnimplementedGreeterServer) Register(context.Context, *RegisterRequest) (*emptypb.Empty, error)
- func (UnimplementedGreeterServer) UpdateUserInfo(context.Context, *UpdateUserReq) (*emptypb.Empty, error)
- type UnsafeGreeterServer
- type UpdateUserReq
- func (*UpdateUserReq) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateUserReq) GetAvatar() string
- func (x *UpdateUserReq) GetId() int64
- func (*UpdateUserReq) ProtoMessage()
- func (x *UpdateUserReq) ProtoReflect() protoreflect.Message
- func (x *UpdateUserReq) Reset()
- func (x *UpdateUserReq) String() string
Constants ¶
const ( Greeter_Register_FullMethodName = "/auth.v1.Greeter/Register" Greeter_Login_FullMethodName = "/auth.v1.Greeter/Login" Greeter_GetIdByToken_FullMethodName = "/auth.v1.Greeter/GetIdByToken" Greeter_UpdateUserInfo_FullMethodName = "/auth.v1.Greeter/UpdateUserInfo" )
const OperationGreeterGetIdByToken = "/auth.v1.Greeter/GetIdByToken"
const OperationGreeterLogin = "/auth.v1.Greeter/Login"
const OperationGreeterRegister = "/auth.v1.Greeter/Register"
const OperationGreeterUpdateUserInfo = "/auth.v1.Greeter/UpdateUserInfo"
Variables ¶
var ( ErrorReason_name = map[int32]string{ 0: "GREETER_UNSPECIFIED", 1: "USER_NOT_FOUND", 2: "USER_AUTH_ERROR", 3: "Internal_Error", } ErrorReason_value = map[string]int32{ "GREETER_UNSPECIFIED": 0, "USER_NOT_FOUND": 1, "USER_AUTH_ERROR": 2, "Internal_Error": 3, } )
Enum value maps for ErrorReason.
var File_auth_v1_auth_proto protoreflect.FileDescriptor
var File_auth_v1_error_reason_proto protoreflect.FileDescriptor
var Greeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "auth.v1.Greeter", HandlerType: (*GreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Register", Handler: _Greeter_Register_Handler, }, { MethodName: "Login", Handler: _Greeter_Login_Handler, }, { MethodName: "GetIdByToken", Handler: _Greeter_GetIdByToken_Handler, }, { MethodName: "UpdateUserInfo", Handler: _Greeter_UpdateUserInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "auth/v1/auth.proto", }
Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func ErrorUserNotFound ¶
func InternalError ¶
func IsInternalError ¶
func IsUserAuthError ¶
func IsUserNotFound ¶
func RegisterGreeterHTTPServer ¶
func RegisterGreeterHTTPServer(s *http.Server, srv GreeterHTTPServer)
func RegisterGreeterServer ¶
func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
func UserAuthError ¶
Types ¶
type AuthReply ¶
type AuthReply struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // contains filtered or unexported fields }
func (*AuthReply) Descriptor
deprecated
func (*AuthReply) ProtoMessage ¶
func (*AuthReply) ProtoMessage()
func (*AuthReply) ProtoReflect ¶
func (x *AuthReply) ProtoReflect() protoreflect.Message
type AuthRequest ¶
type AuthRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*AuthRequest) Descriptor
deprecated
func (*AuthRequest) Descriptor() ([]byte, []int)
Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.
func (*AuthRequest) GetPassword ¶
func (x *AuthRequest) GetPassword() string
func (*AuthRequest) GetUsername ¶
func (x *AuthRequest) GetUsername() string
func (*AuthRequest) ProtoMessage ¶
func (*AuthRequest) ProtoMessage()
func (*AuthRequest) ProtoReflect ¶
func (x *AuthRequest) ProtoReflect() protoreflect.Message
func (*AuthRequest) Reset ¶
func (x *AuthRequest) Reset()
func (*AuthRequest) String ¶
func (x *AuthRequest) String() string
type ErrorReason ¶
type ErrorReason int32
const ( ErrorReason_GREETER_UNSPECIFIED ErrorReason = 0 ErrorReason_USER_NOT_FOUND ErrorReason = 1 ErrorReason_USER_AUTH_ERROR ErrorReason = 2 ErrorReason_Internal_Error ErrorReason = 3 )
func (ErrorReason) Descriptor ¶
func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
func (ErrorReason) Enum ¶
func (x ErrorReason) Enum() *ErrorReason
func (ErrorReason) EnumDescriptor
deprecated
func (ErrorReason) EnumDescriptor() ([]byte, []int)
Deprecated: Use ErrorReason.Descriptor instead.
func (ErrorReason) Number ¶
func (x ErrorReason) Number() protoreflect.EnumNumber
func (ErrorReason) String ¶
func (x ErrorReason) String() string
func (ErrorReason) Type ¶
func (ErrorReason) Type() protoreflect.EnumType
type GetIdByTokenReply ¶
type GetIdByTokenReply struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetIdByTokenReply) Descriptor
deprecated
func (*GetIdByTokenReply) Descriptor() ([]byte, []int)
Deprecated: Use GetIdByTokenReply.ProtoReflect.Descriptor instead.
func (*GetIdByTokenReply) GetId ¶
func (x *GetIdByTokenReply) GetId() int64
func (*GetIdByTokenReply) ProtoMessage ¶
func (*GetIdByTokenReply) ProtoMessage()
func (*GetIdByTokenReply) ProtoReflect ¶
func (x *GetIdByTokenReply) ProtoReflect() protoreflect.Message
func (*GetIdByTokenReply) Reset ¶
func (x *GetIdByTokenReply) Reset()
func (*GetIdByTokenReply) String ¶
func (x *GetIdByTokenReply) String() string
type GetIdByTokenReq ¶
type GetIdByTokenReq struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // contains filtered or unexported fields }
func (*GetIdByTokenReq) Descriptor
deprecated
func (*GetIdByTokenReq) Descriptor() ([]byte, []int)
Deprecated: Use GetIdByTokenReq.ProtoReflect.Descriptor instead.
func (*GetIdByTokenReq) GetToken ¶
func (x *GetIdByTokenReq) GetToken() string
func (*GetIdByTokenReq) ProtoMessage ¶
func (*GetIdByTokenReq) ProtoMessage()
func (*GetIdByTokenReq) ProtoReflect ¶
func (x *GetIdByTokenReq) ProtoReflect() protoreflect.Message
func (*GetIdByTokenReq) Reset ¶
func (x *GetIdByTokenReq) Reset()
func (*GetIdByTokenReq) String ¶
func (x *GetIdByTokenReq) String() string
type GreeterClient ¶
type GreeterClient interface { // Sends a greeting Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) Login(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) GetIdByToken(ctx context.Context, in *GetIdByTokenReq, opts ...grpc.CallOption) (*GetIdByTokenReply, error) UpdateUserInfo(ctx context.Context, in *UpdateUserReq, opts ...grpc.CallOption) (*emptypb.Empty, error) }
GreeterClient is the client API for Greeter 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 NewGreeterClient ¶
func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient
type GreeterHTTPClient ¶
type GreeterHTTPClient interface { GetIdByToken(ctx context.Context, req *GetIdByTokenReq, opts ...http.CallOption) (rsp *GetIdByTokenReply, err error) Login(ctx context.Context, req *AuthRequest, opts ...http.CallOption) (rsp *AuthReply, err error) Register(ctx context.Context, req *RegisterRequest, opts ...http.CallOption) (rsp *emptypb.Empty, err error) UpdateUserInfo(ctx context.Context, req *UpdateUserReq, opts ...http.CallOption) (rsp *emptypb.Empty, err error) }
func NewGreeterHTTPClient ¶
func NewGreeterHTTPClient(client *http.Client) GreeterHTTPClient
type GreeterHTTPClientImpl ¶
type GreeterHTTPClientImpl struct {
// contains filtered or unexported fields
}
func (*GreeterHTTPClientImpl) GetIdByToken ¶
func (c *GreeterHTTPClientImpl) GetIdByToken(ctx context.Context, in *GetIdByTokenReq, opts ...http.CallOption) (*GetIdByTokenReply, error)
func (*GreeterHTTPClientImpl) Login ¶
func (c *GreeterHTTPClientImpl) Login(ctx context.Context, in *AuthRequest, opts ...http.CallOption) (*AuthReply, error)
func (*GreeterHTTPClientImpl) Register ¶
func (c *GreeterHTTPClientImpl) Register(ctx context.Context, in *RegisterRequest, opts ...http.CallOption) (*emptypb.Empty, error)
func (*GreeterHTTPClientImpl) UpdateUserInfo ¶
func (c *GreeterHTTPClientImpl) UpdateUserInfo(ctx context.Context, in *UpdateUserReq, opts ...http.CallOption) (*emptypb.Empty, error)
type GreeterHTTPServer ¶
type GreeterHTTPServer interface { GetIdByToken(context.Context, *GetIdByTokenReq) (*GetIdByTokenReply, error) Login(context.Context, *AuthRequest) (*AuthReply, error) // Register Sends a greeting Register(context.Context, *RegisterRequest) (*emptypb.Empty, error) UpdateUserInfo(context.Context, *UpdateUserReq) (*emptypb.Empty, error) }
type GreeterServer ¶
type GreeterServer interface { // Sends a greeting Register(context.Context, *RegisterRequest) (*emptypb.Empty, error) Login(context.Context, *AuthRequest) (*AuthReply, error) GetIdByToken(context.Context, *GetIdByTokenReq) (*GetIdByTokenReply, error) UpdateUserInfo(context.Context, *UpdateUserReq) (*emptypb.Empty, error) // contains filtered or unexported methods }
GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility
type RegisterRequest ¶
type RegisterRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` // contains filtered or unexported fields }
func (*RegisterRequest) Descriptor
deprecated
func (*RegisterRequest) Descriptor() ([]byte, []int)
Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.
func (*RegisterRequest) GetAvatar ¶
func (x *RegisterRequest) GetAvatar() string
func (*RegisterRequest) GetEmail ¶
func (x *RegisterRequest) GetEmail() string
func (*RegisterRequest) GetPassword ¶
func (x *RegisterRequest) GetPassword() string
func (*RegisterRequest) GetUsername ¶
func (x *RegisterRequest) GetUsername() string
func (*RegisterRequest) ProtoMessage ¶
func (*RegisterRequest) ProtoMessage()
func (*RegisterRequest) ProtoReflect ¶
func (x *RegisterRequest) ProtoReflect() protoreflect.Message
func (*RegisterRequest) Reset ¶
func (x *RegisterRequest) Reset()
func (*RegisterRequest) String ¶
func (x *RegisterRequest) String() string
type UnimplementedGreeterServer ¶
type UnimplementedGreeterServer struct { }
UnimplementedGreeterServer must be embedded to have forward compatible implementations.
func (UnimplementedGreeterServer) GetIdByToken ¶
func (UnimplementedGreeterServer) GetIdByToken(context.Context, *GetIdByTokenReq) (*GetIdByTokenReply, error)
func (UnimplementedGreeterServer) Login ¶
func (UnimplementedGreeterServer) Login(context.Context, *AuthRequest) (*AuthReply, error)
func (UnimplementedGreeterServer) Register ¶
func (UnimplementedGreeterServer) Register(context.Context, *RegisterRequest) (*emptypb.Empty, error)
func (UnimplementedGreeterServer) UpdateUserInfo ¶
func (UnimplementedGreeterServer) UpdateUserInfo(context.Context, *UpdateUserReq) (*emptypb.Empty, error)
type UnsafeGreeterServer ¶
type UnsafeGreeterServer interface {
// contains filtered or unexported methods
}
UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GreeterServer will result in compilation errors.
type UpdateUserReq ¶
type UpdateUserReq struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Avatar string `protobuf:"bytes,2,opt,name=avatar,proto3" json:"avatar,omitempty"` // contains filtered or unexported fields }
func (*UpdateUserReq) Descriptor
deprecated
func (*UpdateUserReq) Descriptor() ([]byte, []int)
Deprecated: Use UpdateUserReq.ProtoReflect.Descriptor instead.
func (*UpdateUserReq) GetAvatar ¶
func (x *UpdateUserReq) GetAvatar() string
func (*UpdateUserReq) GetId ¶
func (x *UpdateUserReq) GetId() int64
func (*UpdateUserReq) ProtoMessage ¶
func (*UpdateUserReq) ProtoMessage()
func (*UpdateUserReq) ProtoReflect ¶
func (x *UpdateUserReq) ProtoReflect() protoreflect.Message
func (*UpdateUserReq) Reset ¶
func (x *UpdateUserReq) Reset()
func (*UpdateUserReq) String ¶
func (x *UpdateUserReq) String() string