warren830 commented on code in PR #1994:
URL: https://github.com/apache/incubator-devlake/pull/1994#discussion_r887726672


##########
plugins/helper/connection.go:
##########
@@ -0,0 +1,214 @@
+package helper
+
+import (
+       "encoding/base64"
+       "fmt"
+       "github.com/apache/incubator-devlake/config"
+       "github.com/apache/incubator-devlake/models/common"
+       "github.com/apache/incubator-devlake/plugins/core"
+       "github.com/go-playground/validator/v10"
+       "github.com/mitchellh/mapstructure"
+       "gorm.io/gorm"
+       "gorm.io/gorm/clause"
+       "reflect"
+       "strconv"
+)
+
+type BaseConnection struct {
+       Name string `gorm:"type:varchar(100);uniqueIndex" json:"name" 
validate:"required"`
+       common.Model
+}
+
+type BasicAuth struct {
+       Username string `mapstructure:"username" validate:"required" 
json:"username"`
+       Password string `mapstructure:"password" validate:"required" 
json:"password" encryptField:"yes"`
+}
+
+func (ba BasicAuth) GetEncodedToken() string {
+       return base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%v:%v", 
ba.Username, ba.Password)))
+}
+
+type AccessToken struct {
+       Token string `mapstructure:"token" validate:"required" json:"token" 
encryptField:"yes"`
+}
+
+type RestConnection struct {
+       BaseConnection `mapstructure:",squash"`

Review Comment:
   yes, this comma is needed, otherwise, `squash` will not be effective



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