add signup method

This commit is contained in:
2026-06-29 00:46:57 +07:00
parent 3ec2853df6
commit bb2cb3a540
6 changed files with 300 additions and 19 deletions
+40 -2
View File
@@ -19,8 +19,9 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
EveningDetectiveServer_Ping_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Ping"
EveningDetectiveServer_Echo_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Echo"
EveningDetectiveServer_Ping_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Ping"
EveningDetectiveServer_Echo_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Echo"
EveningDetectiveServer_Signup_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/Signup"
)
// EveningDetectiveServerClient is the client API for EveningDetectiveServer service.
@@ -29,6 +30,7 @@ const (
type EveningDetectiveServerClient interface {
Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error)
Echo(ctx context.Context, in *EchoReq, opts ...grpc.CallOption) (*EchoRsp, error)
Signup(ctx context.Context, in *SignupReq, opts ...grpc.CallOption) (*SignupRsp, error)
}
type eveningDetectiveServerClient struct {
@@ -59,12 +61,23 @@ func (c *eveningDetectiveServerClient) Echo(ctx context.Context, in *EchoReq, op
return out, nil
}
func (c *eveningDetectiveServerClient) Signup(ctx context.Context, in *SignupReq, opts ...grpc.CallOption) (*SignupRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SignupRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_Signup_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.
type EveningDetectiveServerServer interface {
Ping(context.Context, *PingReq) (*PingRsp, error)
Echo(context.Context, *EchoReq) (*EchoRsp, error)
Signup(context.Context, *SignupReq) (*SignupRsp, error)
mustEmbedUnimplementedEveningDetectiveServerServer()
}
@@ -81,6 +94,9 @@ func (UnimplementedEveningDetectiveServerServer) Ping(context.Context, *PingReq)
func (UnimplementedEveningDetectiveServerServer) Echo(context.Context, *EchoReq) (*EchoRsp, error) {
return nil, status.Error(codes.Unimplemented, "method Echo not implemented")
}
func (UnimplementedEveningDetectiveServerServer) Signup(context.Context, *SignupReq) (*SignupRsp, error) {
return nil, status.Error(codes.Unimplemented, "method Signup not implemented")
}
func (UnimplementedEveningDetectiveServerServer) mustEmbedUnimplementedEveningDetectiveServerServer() {
}
func (UnimplementedEveningDetectiveServerServer) testEmbeddedByValue() {}
@@ -139,6 +155,24 @@ func _EveningDetectiveServer_Echo_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_Signup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SignupReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).Signup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_Signup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).Signup(ctx, req.(*SignupReq))
}
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)
@@ -154,6 +188,10 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "Echo",
Handler: _EveningDetectiveServer_Echo_Handler,
},
{
MethodName: "Signup",
Handler: _EveningDetectiveServer_Signup_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "main.proto",