This is an automated email from the ASF dual-hosted git repository.
Alanxtl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new ee88f77d4 feat(metadata): add descriptions for GetMethods(),
GetParams() and NewServiceInfoWithURL() (#3619)
ee88f77d4 is described below
commit ee88f77d4398a5b7a79d1b8e3f9afdb96dd9cdeb
Author: Nene7ko_ <[email protected]>
AuthorDate: Sun Aug 9 12:52:22 2026 +0800
feat(metadata): add descriptions for GetMethods(), GetParams() and
NewServiceInfoWithURL() (#3619)
---
metadata/info/metadata_info.go | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/metadata/info/metadata_info.go b/metadata/info/metadata_info.go
index 4621744f7..c8f770a37 100644
--- a/metadata/info/metadata_info.go
+++ b/metadata/info/metadata_info.go
@@ -268,6 +268,9 @@ type ServiceInfo struct {
URL *common.URL `json:"-" hessian:"-"`
}
+// NewServiceInfoWithURL builds a service-level metadata view from provider
URL.
+// It copies the service identity and endpoint fields, retains only
whitelisted service and
+// method parameters, and stores method parameters in the compact
"<method>.<key>" form.
func NewServiceInfoWithURL(url *common.URL) *ServiceInfo {
service := NewServiceInfo(url.Service(), url.Group(), url.Version(),
url.Protocol, url.Path, nil)
service.Port, _ = strconv.Atoi(url.Port)
@@ -311,11 +314,19 @@ func (si *ServiceInfo) JavaClassName() string {
return "org.apache.dubbo.metadata.MetadataInfo$ServiceInfo"
}
+// GetMethods returns the service method name corresponding to MethodsKey.
+// The comma-separated representation preserves the order found in the
provider URL.
+// If the parameter is null, the current implementation returns a list of
method names containing a single empty string.
func (si *ServiceInfo) GetMethods() []string {
s := si.Params[constant.MethodsKey]
return strings.Split(s, ",")
}
+// GetParams reconstructs URL query parameters from the serialized service
metadata.
+// Method parameters are stored compactly as "<method>.<key>" in ServiceInfo
and are expanded
+// to "methods.<method>.<key>" when the method is listed in MethodsKey. All
other parameters
+// keep their original keys. The returned url.Values is newly allocated and
can be used to
+// rebuild a consumer URL without modifying ServiceInfo.Params.
func (si *ServiceInfo) GetParams() url.Values {
v := url.Values{}
methods := gxset.NewSet()