iferr:=db.QueryRow(`SELECT x.active FROM edgeregistry."EdgeDevice" x WHERE x.edgeid = $1 AND x.edgesecret = $2 AND x.active = true`,edgeid,edgesecret).Scan(&active);err!=nil{
_,err:=db.Exec(`UPDATE edgeregistry."EdgeDevice" SET connected = $1 WHERE edgeid = $2 AND edgesecret = $3 AND tunnelbrokerport = $4`,conn,edgeid,edgesecret,tunnelbrokerport)
rows,err:=db.Query(`SELECT x.edgeid, x.edgesecret, x.edgetype, x.alias, x.tunnelbrokerport, x.active FROM edgeregistry."EdgeDevice" x WHERE x.edgeid = $1 AND x.edgesecret = $2 AND x.active = true`,edgeid,edgesecret)