Mulavar commented on a change in pull request #1491:
URL: https://github.com/apache/dubbo-go/pull/1491#discussion_r717220016



##########
File path: config/application_config.go
##########
@@ -113,3 +113,53 @@ func WithMetadataType(metadataType string) 
ApplicationConfigOpt {
                ac.MetadataType = metadataType
        }
 }
+
+func NewApplicationConfigBuilder() *ApplicationConfigBuilder {
+       return &ApplicationConfigBuilder{application: &ApplicationConfig{}}
+}
+
+type ApplicationConfigBuilder struct {
+       application *ApplicationConfig
+}
+
+func (acb *ApplicationConfigBuilder) Organization(organization string) 
*ApplicationConfigBuilder {

Review comment:
       一般这种builder模式的运用,在链式赋值时都不会使用set。
   我理解是因为这种模式下没有 get 的场景,所以单独的 set 并不会给到更多的语义信息,可忽略。

##########
File path: config/application_config.go
##########
@@ -113,3 +113,53 @@ func WithMetadataType(metadataType string) 
ApplicationConfigOpt {
                ac.MetadataType = metadataType
        }
 }
+
+func NewApplicationConfigBuilder() *ApplicationConfigBuilder {
+       return &ApplicationConfigBuilder{application: &ApplicationConfig{}}
+}
+
+type ApplicationConfigBuilder struct {
+       application *ApplicationConfig
+}
+
+func (acb *ApplicationConfigBuilder) Organization(organization string) 
*ApplicationConfigBuilder {

Review comment:
       可参考 curator,okhttp3 等框架。




-- 
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]

Reply via email to