lishuo5263 commented on code in PR #35:
URL: 
https://github.com/apache/shenyu-client-golang/pull/35#discussion_r946374066


##########
clients/etcd_client/etcd_client.go:
##########
@@ -17,32 +17,179 @@
 
 package etcd_client
 
+import (
+       "context"
+       "encoding/json"
+       "github.com/apache/shenyu-client-golang/model"
+       "github.com/wonderivan/logger"
+       clientv3 "go.etcd.io/etcd/client/v3"
+       "time"
+)
+
 /**
  * ShenYuEtcdClient
  **/
 type ShenYuEtcdClient struct {
        Ecp *EtcdClientParam //EtcdClientParam
-
+    EtcdClient *clientv3.Client //EtcdClient
+    GlobalLease clientv3.LeaseID //global lease
 }
 
 /**
- * ConsulClientParam
+ * EtcdClientParam
  **/
 type EtcdClientParam struct {
+       EtcdServers  []string //the customer etcd server address
+       UserName string //the customer etcd server userName
+       Password  string    //the customer etcd server pwd
+       TimeOut int64   //the customer etcd server timeout
+       TTL int64 //the customer etcd key rent
 }
 
-func (sec ShenYuEtcdClient) NewClient(clientParam interface{}) (client 
interface{}, createResult bool, err error) {
-       panic("implement me")
+/**
+ * init NewClient
+ **/
+func (sec *ShenYuEtcdClient) NewClient(clientParam interface{}) (client 
interface{}, createResult bool, err error) {
+       ecp, ok := clientParam.(*EtcdClientParam)
+       if !ok {
+               logger.Fatal("init etcd client error %+v:", err)
+       }
+       if len(ecp.EtcdServers) > 0 {
+               if ecp.TimeOut == 0 {
+                       ecp.TimeOut = 5

Review Comment:
   Use const to replace timeOut



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

Reply via email to