You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/01 13:07:25 UTC

[GitHub] [dubbo-go-samples] PhilYue commented on a change in pull request #214: Ftr/jsonrpc using dubbogo config

PhilYue commented on a change in pull request #214:
URL: https://github.com/apache/dubbo-go-samples/pull/214#discussion_r700194133



##########
File path: rpc/jsonrpc/go-client/pkg/user.go
##########
@@ -34,18 +34,18 @@ type JsonRPCUser struct {
 func (u JsonRPCUser) String() string {
 	return fmt.Sprintf(
 		"User{ID:%s, Name:%s, Age:%d, Time:%s, Sex:%s}",
-		u.ID, u.Name, u.Age, time.Unix(u.Time, 0).Format("2006-01-02 15:04:05.99999"), u.Sex,
+		u.ID, u.Name, u.Age, time.Unix(int64(u.Time), 0).Format("2006-01-02 15:04:05.99999"), u.Sex,
 	)
 }
 
 type UserProvider struct {
 	GetUsers func(req []interface{}) ([]JsonRPCUser, error)
-	GetUser  func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
+	GetUser  func(ctx context.Context, req []interface{}) (JsonRPCUser, error)
 	GetUser0 func(id string, name string) (JsonRPCUser, error)
-	GetUser1 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error
-	GetUser2 func(ctx context.Context, req []interface{}, rsp *JsonRPCUser) error `dubbo:"getUser"`
+	GetUser1 func(ctx context.Context, req []interface{}) (JsonRPCUser, error)
+	GetUser2 func(ctx context.Context, req []interface{}) (JsonRPCUser, error) `dubbo:"getUser"`

Review comment:
       yep,我尝试过,全改成具体类型后发现没发调通,晚一点我再尝试一下!

##########
File path: rpc/jsonrpc/go-server/pkg/user_provider.go
##########
@@ -29,7 +45,7 @@ func (u *UserProvider) getUser(userID string) (*User, error) {
 	return nil, fmt.Errorf("invalid user id:%s", userID)
 }
 
-func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User) error {
+func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {

Review comment:
       yep!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org