@@ -53,22 +53,14 @@ func NewConnectionHelper(
5353 if vld == nil {
5454 vld = validator .New ()
5555 }
56- h := & ConnectionApiHelper {
56+ return & ConnectionApiHelper {
5757 encryptionSecret : basicRes .GetConfig (plugin .EncodeKeyEnvStr ),
5858 log : basicRes .GetLogger (),
5959 db : basicRes .GetDal (),
6060 validator : vld ,
6161 bpManager : services .NewBlueprintManager (basicRes .GetDal ()),
6262 pluginName : pluginName ,
6363 }
64- if h .db == nil {
65- h .log .Info ("connection api helper db is nil" )
66- fmt .Println ("connection api helper db is nil" )
67- } else {
68- h .log .Info ("connection api helper db is not nil" )
69- fmt .Println ("connection api helper db is not nil" )
70- }
71- return h
7264}
7365
7466// Create a connection record based on request body
@@ -127,25 +119,6 @@ func (c *ConnectionApiHelper) FirstById(connection interface{}, id uint64) error
127119
128120// List returns all connections with password/token decrypted
129121func (c * ConnectionApiHelper ) List (connections interface {}) errors.Error {
130- if c == nil {
131- c .log .Info ("connection api helper is nil" )
132- fmt .Printf ("connection api helper is nil\n " )
133- } else {
134- c .log .Info ("%s, connections :%+v" , c .pluginName , connections )
135- fmt .Printf ("%s connections :%+v\n " , c .pluginName , connections )
136- c .log .Info ("%s connection api helper :%+v" , c .pluginName , c )
137- fmt .Printf ("%s connection api helper :%+v\n " , c .pluginName , c )
138- c .log .Info ("%s connection api helper is not nil" , c .pluginName )
139- fmt .Printf ("%s connection api helper is not nil\n " , c .pluginName )
140- if c .db == nil {
141- c .log .Info ("%s connection api helper db is nil" , c .pluginName )
142- fmt .Printf ("%s connection api helper db is nil\n " , c .pluginName )
143- } else {
144- c .log .Info ("%s connection api helper db is not nil" , c .pluginName )
145- fmt .Printf ("%s connection api helper db is not nil" , c .pluginName )
146- }
147- }
148-
149122 return CallDB (c .db .All , connections )
150123}
151124
0 commit comments