From 154f72d42aaca707360377e028c7631bb981df1e Mon Sep 17 00:00:00 2001 From: "shruti.wadnerkar" Date: Fri, 4 Oct 2019 16:47:47 +0530 Subject: [PATCH] activityController-optimization --- controllers/activityController.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controllers/activityController.go b/controllers/activityController.go index 5f8fb1c..a6adea3 100644 --- a/controllers/activityController.go +++ b/controllers/activityController.go @@ -6,12 +6,13 @@ import ( ) func connectUsers(uid1 string, uid2 string) bool { + res := false methodSource := "MethodSource : connectUsers." db, err := sql.Open("neo4j-cypher", getConnectionUrl()) err = db.Ping() if err != nil { logMessage(methodSource + "Failed to Establish Connection. Desc: " + err.Error()) - return false + return res } defer db.Close() stmt, err := db.Prepare(`MATCH (a:User {uid:{0}}),(b:User{uid:{1}}) @@ -20,13 +21,13 @@ func connectUsers(uid1 string, uid2 string) bool { `) if err != nil { logMessage(methodSource + "Error Preparing Query.Desc: " + err.Error()) - return false + return res } defer stmt.Close() _, errExec := stmt.Exec(uid1, uid2, relationshipProperty()) if errExec != nil { logMessage(methodSource + "Error executing query for Connection creation.Desc: " + errExec.Error()) - return false + return res } return true }