成功注册到consul

This commit is contained in:
2025-01-20 16:01:57 +08:00
parent a53f8f8a5a
commit 76d3d6f20a
16 changed files with 430 additions and 114 deletions
+13 -13
View File
@@ -242,17 +242,17 @@ var file_user_proto_rawDesc = []byte{
0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x24, 0x0a, 0x09, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
0x32, 0x6f, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0x34, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x12, 0x2e, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x1a,
0x12, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52,
0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0f,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22,
0x00, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x73, 0x75, 0x79, 0x69, 0x69, 0x79, 0x69, 0x69, 0x2f, 0x68, 0x65, 0x72, 0x74, 0x7a, 0x31, 0x30,
0x31, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x2f, 0x6b, 0x69, 0x74, 0x65, 0x78, 0x5f,
0x67, 0x65, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x32, 0x6e, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0x33, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x12,
0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x22, 0x00, 0x12, 0x2a, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73,
0x75, 0x79, 0x69, 0x69, 0x79, 0x69, 0x69, 0x2f, 0x68, 0x65, 0x72, 0x74, 0x7a, 0x31, 0x30, 0x31,
0x2f, 0x72, 0x70, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x2f, 0x6b, 0x69, 0x74, 0x65, 0x78, 0x5f, 0x67,
0x65, 0x6e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -275,7 +275,7 @@ var file_user_proto_goTypes = []interface{}{
(*LoginResp)(nil), // 3: user.LoginResp
}
var file_user_proto_depIdxs = []int32{
1, // 0: user.UserService.Register:input_type -> user.RegisterResp
0, // 0: user.UserService.Register:input_type -> user.RegisterReq
2, // 1: user.UserService.Login:input_type -> user.LoginReq
1, // 2: user.UserService.Register:output_type -> user.RegisterResp
3, // 3: user.UserService.Login:output_type -> user.LoginResp
@@ -366,6 +366,6 @@ var _ context.Context
// Code generated by Kitex v0.9.1. DO NOT EDIT.
type UserService interface {
Register(ctx context.Context, req *RegisterResp) (res *RegisterResp, err error)
Register(ctx context.Context, req *RegisterReq) (res *RegisterResp, err error)
Login(ctx context.Context, req *LoginReq) (res *LoginResp, err error)
}
+2 -2
View File
@@ -11,7 +11,7 @@ import (
// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
type Client interface {
Register(ctx context.Context, Req *user.RegisterResp, callOptions ...callopt.Option) (r *user.RegisterResp, err error)
Register(ctx context.Context, Req *user.RegisterReq, callOptions ...callopt.Option) (r *user.RegisterResp, err error)
Login(ctx context.Context, Req *user.LoginReq, callOptions ...callopt.Option) (r *user.LoginResp, err error)
}
@@ -44,7 +44,7 @@ type kUserServiceClient struct {
*kClient
}
func (p *kUserServiceClient) Register(ctx context.Context, Req *user.RegisterResp, callOptions ...callopt.Option) (r *user.RegisterResp, err error) {
func (p *kUserServiceClient) Register(ctx context.Context, Req *user.RegisterReq, callOptions ...callopt.Option) (r *user.RegisterResp, err error) {
ctx = client.NewCtxWithCallOptions(ctx, callOptions)
return p.kClient.Register(ctx, Req)
}
@@ -99,7 +99,7 @@ func registerHandler(ctx context.Context, handler interface{}, arg, result inter
switch s := arg.(type) {
case *streaming.Args:
st := s.Stream
req := new(user.RegisterResp)
req := new(user.RegisterReq)
if err := st.RecvMsg(req); err != nil {
return err
}
@@ -129,12 +129,12 @@ func newRegisterResult() interface{} {
}
type RegisterArgs struct {
Req *user.RegisterResp
Req *user.RegisterReq
}
func (p *RegisterArgs) FastRead(buf []byte, _type int8, number int32) (n int, err error) {
if !p.IsSetReq() {
p.Req = new(user.RegisterResp)
p.Req = new(user.RegisterReq)
}
return p.Req.FastRead(buf, _type, number)
}
@@ -161,7 +161,7 @@ func (p *RegisterArgs) Marshal(out []byte) ([]byte, error) {
}
func (p *RegisterArgs) Unmarshal(in []byte) error {
msg := new(user.RegisterResp)
msg := new(user.RegisterReq)
if err := proto.Unmarshal(in, msg); err != nil {
return err
}
@@ -169,9 +169,9 @@ func (p *RegisterArgs) Unmarshal(in []byte) error {
return nil
}
var RegisterArgs_Req_DEFAULT *user.RegisterResp
var RegisterArgs_Req_DEFAULT *user.RegisterReq
func (p *RegisterArgs) GetReq() *user.RegisterResp {
func (p *RegisterArgs) GetReq() *user.RegisterReq {
if !p.IsSetReq() {
return RegisterArgs_Req_DEFAULT
}
@@ -411,7 +411,7 @@ func newServiceClient(c client.Client) *kClient {
}
}
func (p *kClient) Register(ctx context.Context, Req *user.RegisterResp) (r *user.RegisterResp, err error) {
func (p *kClient) Register(ctx context.Context, Req *user.RegisterReq) (r *user.RegisterResp, err error) {
var _args RegisterArgs
_args.Req = Req
var _result RegisterResult