XiaoFeiASK commented on code in PR #3594:
URL: https://github.com/apache/dubbo-go/pull/3594#discussion_r3719421135
##########
filter/generic/service.go:
##########
@@ -19,40 +19,64 @@ package generic
import (
"context"
- "reflect"
)
import (
hessian "github.com/apache/dubbo-go-hessian2"
)
import (
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/filter/generic/generalizer"
)
// GenericService uses for generic invoke for service call
type GenericService struct {
Invoke func(ctx context.Context, methodName string, types
[]string, args []hessian.Object) (any, error) `dubbo:"$invoke"`
referenceStr string
+ generic string
}
// NewGenericService returns a GenericService instance
func NewGenericService(referenceStr string) *GenericService {
- return &GenericService{referenceStr: referenceStr}
+ return &GenericService{referenceStr: referenceStr, generic:
constant.GenericSerializationDefault}
}
// Reference gets referenceStr from GenericService
func (s *GenericService) Reference() string {
return s.referenceStr
}
+// SetGenericType sets the generic mode used by InvokeWithType to realize
typed results.
+func (s *GenericService) SetGenericType(generic string) error {
+ if generic == "" {
+ generic = constant.GenericSerializationDefault
Review Comment:
done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]