add login route

This commit is contained in:
2026-07-02 03:30:51 +07:00
parent d22ad7cb09
commit 20ada8caa2
9 changed files with 389 additions and 12 deletions
+38
View File
@@ -23,6 +23,7 @@ const (
EveningDetectiveServer_Echo_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Echo"
EveningDetectiveServer_Signup_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Signup"
EveningDetectiveServer_RefreshPassword_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/RefreshPassword"
EveningDetectiveServer_Login_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Login"
)
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
@@ -33,6 +34,7 @@ type EveningDetectiveServerClient interface {
Echo(ctx context.Context, in *EchoReq, opts ...grpc.CallOption) (*EchoRsp, error)
Signup(ctx context.Context, in *SignupReq, opts ...grpc.CallOption) (*SignupRsp, error)
RefreshPassword(ctx context.Context, in *RefreshPasswordReq, opts ...grpc.CallOption) (*RefreshPasswordRsp, error)
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRsp, error)
}
type eveningDetectiveServerClient struct {
@@ -83,6 +85,16 @@ func (c *eveningDetectiveServerClient) RefreshPassword(ctx context.Context, in *
return out, nil
}
func (c *eveningDetectiveServerClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LoginRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_Login_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// EveningDetectiveServerServer is the server API for EveningDetectiveServer service.
// All implementations must embed UnimplementedEveningDetectiveServerServer
// for forward compatibility.
@@ -91,6 +103,7 @@ type EveningDetectiveServerServer interface {
Echo(context.Context, *EchoReq) (*EchoRsp, error)
Signup(context.Context, *SignupReq) (*SignupRsp, error)
RefreshPassword(context.Context, *RefreshPasswordReq) (*RefreshPasswordRsp, error)
Login(context.Context, *LoginReq) (*LoginRsp, error)
mustEmbedUnimplementedEveningDetectiveServerServer()
}
@@ -113,6 +126,9 @@ func (UnimplementedEveningDetectiveServerServer) Signup(context.Context, *Signup
func (UnimplementedEveningDetectiveServerServer) RefreshPassword(context.Context, *RefreshPasswordReq) (*RefreshPasswordRsp, error) {
return nil, status.Error(codes.Unimplemented, "method RefreshPassword not implemented")
}
func (UnimplementedEveningDetectiveServerServer) Login(context.Context, *LoginReq) (*LoginRsp, error) {
return nil, status.Error(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
}
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
@@ -207,6 +223,24 @@ func _EveningDetectiveServer_RefreshPassword_Handler(srv interface{}, ctx contex
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_Login_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).Login(ctx, req.(*LoginReq))
}
return interceptor(ctx, in, info, handler)
}
// EveningDetectiveServer_ServiceDesc is the grpc.ServiceDesc for EveningDetectiveServer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -230,6 +264,10 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "RefreshPassword",
Handler: _EveningDetectiveServer_RefreshPassword_Handler,
},
{
MethodName: "Login",
Handler: _EveningDetectiveServer_Login_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",