{"action":"created","comment":{"url":"https://api.github.com/repos/StealthPad/Madness/pulls/comments/205983780","pull_request_review_id":141356983,"id":205983780,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTk4Mzc4MA==","diff_hunk":"@@ -0,0 +1,69 @@\n+//\n+//  KueryDBConnectionManager.swift\n+//  Madness\n+//\n+//  Created by Ryan Krol on 29/07/2018.\n+//\n+//  Song: Portugal. The Man - Noise Pollution\n+\n+import Foundation\n+import SwiftKuery\n+\n+public protocol KueryDBConnectionManager: DBConnectionManager {\n+\n+}\n+\n+extension KueryDBConnectionManager {\n+\n+    /**\n+     Will be responsible for handling the work around setting up a database connection,\n+     and sending off requests, as well as error handling. Working with the response will\n+     happen in the responseHandler\n+     */\n+    func executeDatabaseAction(\n+        parameters: [Any?],\n+        query: Query,\n+        defaultResponse: SimpleResponse,\n+        dbConnectionPool: ConnectionPool,\n+        responseHandler: @escaping (\n+            _ rows: [[String:Any?]]\n+        ) -> SimpleResponse\n+    ) -> SimpleResponse {\n+\n+        var response = defaultResponse\n+        var transactionError: Error?          = nil\n+        var positiveResponse: SimpleResponse? = nil\n+\n+        if let connection = dbConnectionPool.getConnection() {\n+            connection.execute(\n+                query: query,\n+                parameters: parameters\n+            ) { (queryResult) in\n+\n+                if let error = queryResult.asError {\n+                    transactionError = error\n+                }\n+\n+                if let rows = queryResult.asRows {\n+                    positiveResponse = responseHandler(rows)\n+                }\n+\n+            }\n+        }\n+\n+        if let error = transactionError {\n+            response = SimpleResponse(\n+                message: error.localizedDescription,\n+                error: true,\n+                restResponseCode: .internalServerError\n+            )","path":"Sources/Madness/DBConnectionManager/KueryDBConnectionManager.swift","position":59,"original_position":59,"commit_id":"6038da0891940281fb3174e5fac2c6c9e432b437","original_commit_id":"6038da0891940281fb3174e5fac2c6c9e432b437","user":{"login":"Davidde94","id":14052839,"node_id":"MDQ6VXNlcjE0MDUyODM5","avatar_url":"https://avatars3.githubusercontent.com/u/14052839?v=4","gravatar_id":"","url":"https://api.github.com/users/Davidde94","html_url":"https://github.com/Davidde94","followers_url":"https://api.github.com/users/Davidde94/followers","following_url":"https://api.github.com/users/Davidde94/following{/other_user}","gists_url":"https://api.github.com/users/Davidde94/gists{/gist_id}","starred_url":"https://api.github.com/users/Davidde94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Davidde94/subscriptions","organizations_url":"https://api.github.com/users/Davidde94/orgs","repos_url":"https://api.github.com/users/Davidde94/repos","events_url":"https://api.github.com/users/Davidde94/events{/privacy}","received_events_url":"https://api.github.com/users/Davidde94/received_events","type":"User","site_admin":false},"body":"It would be better to throw an error","created_at":"2018-07-29T18:56:16Z","updated_at":"2018-07-29T18:58:53Z","html_url":"https://github.com/StealthPad/Madness/pull/12#discussion_r205983780","pull_request_url":"https://api.github.com/repos/StealthPad/Madness/pulls/12","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/StealthPad/Madness/pulls/comments/205983780"},"html":{"href":"https://github.com/StealthPad/Madness/pull/12#discussion_r205983780"},"pull_request":{"href":"https://api.github.com/repos/StealthPad/Madness/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/StealthPad/Madness/pulls/12","id":204652526,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NjUyNTI2","html_url":"https://github.com/StealthPad/Madness/pull/12","diff_url":"https://github.com/StealthPad/Madness/pull/12.diff","patch_url":"https://github.com/StealthPad/Madness/pull/12.patch","issue_url":"https://api.github.com/repos/StealthPad/Madness/issues/12","number":12,"state":"open","locked":false,"title":"Add shared database connection manager","user":{"login":"RyanMKrol","id":16356366,"node_id":"MDQ6VXNlcjE2MzU2MzY2","avatar_url":"https://avatars3.githubusercontent.com/u/16356366?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanMKrol","html_url":"https://github.com/RyanMKrol","followers_url":"https://api.github.com/users/RyanMKrol/followers","following_url":"https://api.github.com/users/RyanMKrol/following{/other_user}","gists_url":"https://api.github.com/users/RyanMKrol/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanMKrol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanMKrol/subscriptions","organizations_url":"https://api.github.com/users/RyanMKrol/orgs","repos_url":"https://api.github.com/users/RyanMKrol/repos","events_url":"https://api.github.com/users/RyanMKrol/events{/privacy}","received_events_url":"https://api.github.com/users/RyanMKrol/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-29T17:29:17Z","updated_at":"2018-07-29T18:58:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c36fd978eb85540b19e897a5e35826bf532495f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/StealthPad/Madness/pulls/12/commits","review_comments_url":"https://api.github.com/repos/StealthPad/Madness/pulls/12/comments","review_comment_url":"https://api.github.com/repos/StealthPad/Madness/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StealthPad/Madness/issues/12/comments","statuses_url":"https://api.github.com/repos/StealthPad/Madness/statuses/6038da0891940281fb3174e5fac2c6c9e432b437","head":{"label":"StealthPad:develop-ryan","ref":"develop-ryan","sha":"6038da0891940281fb3174e5fac2c6c9e432b437","user":{"login":"StealthPad","id":41490815,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNDkwODE1","avatar_url":"https://avatars0.githubusercontent.com/u/41490815?v=4","gravatar_id":"","url":"https://api.github.com/users/StealthPad","html_url":"https://github.com/StealthPad","followers_url":"https://api.github.com/users/StealthPad/followers","following_url":"https://api.github.com/users/StealthPad/following{/other_user}","gists_url":"https://api.github.com/users/StealthPad/gists{/gist_id}","starred_url":"https://api.github.com/users/StealthPad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StealthPad/subscriptions","organizations_url":"https://api.github.com/users/StealthPad/orgs","repos_url":"https://api.github.com/users/StealthPad/repos","events_url":"https://api.github.com/users/StealthPad/events{/privacy}","received_events_url":"https://api.github.com/users/StealthPad/received_events","type":"Organization","site_admin":false},"repo":{"id":141757784,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE3NTc3ODQ=","name":"Madness","full_name":"StealthPad/Madness","owner":{"login":"StealthPad","id":41490815,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNDkwODE1","avatar_url":"https://avatars0.githubusercontent.com/u/41490815?v=4","gravatar_id":"","url":"https://api.github.com/users/StealthPad","html_url":"https://github.com/StealthPad","followers_url":"https://api.github.com/users/StealthPad/followers","following_url":"https://api.github.com/users/StealthPad/following{/other_user}","gists_url":"https://api.github.com/users/StealthPad/gists{/gist_id}","starred_url":"https://api.github.com/users/StealthPad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StealthPad/subscriptions","organizations_url":"https://api.github.com/users/StealthPad/orgs","repos_url":"https://api.github.com/users/StealthPad/repos","events_url":"https://api.github.com/users/StealthPad/events{/privacy}","received_events_url":"https://api.github.com/users/StealthPad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StealthPad/Madness","description":"This is Madness.","fork":false,"url":"https://api.github.com/repos/StealthPad/Madness","forks_url":"https://api.github.com/repos/StealthPad/Madness/forks","keys_url":"https://api.github.com/repos/StealthPad/Madness/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StealthPad/Madness/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StealthPad/Madness/teams","hooks_url":"https://api.github.com/repos/StealthPad/Madness/hooks","issue_events_url":"https://api.github.com/repos/StealthPad/Madness/issues/events{/number}","events_url":"https://api.github.com/repos/StealthPad/Madness/events","assignees_url":"https://api.github.com/repos/StealthPad/Madness/assignees{/user}","branches_url":"https://api.github.com/repos/StealthPad/Madness/branches{/branch}","tags_url":"https://api.github.com/repos/StealthPad/Madness/tags","blobs_url":"https://api.github.com/repos/StealthPad/Madness/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StealthPad/Madness/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StealthPad/Madness/git/refs{/sha}","trees_url":"https://api.github.com/repos/StealthPad/Madness/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StealthPad/Madness/statuses/{sha}","languages_url":"https://api.github.com/repos/StealthPad/Madness/languages","stargazers_url":"https://api.github.com/repos/StealthPad/Madness/stargazers","contributors_url":"https://api.github.com/repos/StealthPad/Madness/contributors","subscribers_url":"https://api.github.com/repos/StealthPad/Madness/subscribers","subscription_url":"https://api.github.com/repos/StealthPad/Madness/subscription","commits_url":"https://api.github.com/repos/StealthPad/Madness/commits{/sha}","git_commits_url":"https://api.github.com/repos/StealthPad/Madness/git/commits{/sha}","comments_url":"https://api.github.com/repos/StealthPad/Madness/comments{/number}","issue_comment_url":"https://api.github.com/repos/StealthPad/Madness/issues/comments{/number}","contents_url":"https://api.github.com/repos/StealthPad/Madness/contents/{+path}","compare_url":"https://api.github.com/repos/StealthPad/Madness/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StealthPad/Madness/merges","archive_url":"https://api.github.com/repos/StealthPad/Madness/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StealthPad/Madness/downloads","issues_url":"https://api.github.com/repos/StealthPad/Madness/issues{/number}","pulls_url":"https://api.github.com/repos/StealthPad/Madness/pulls{/number}","milestones_url":"https://api.github.com/repos/StealthPad/Madness/milestones{/number}","notifications_url":"https://api.github.com/repos/StealthPad/Madness/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StealthPad/Madness/labels{/name}","releases_url":"https://api.github.com/repos/StealthPad/Madness/releases{/id}","deployments_url":"https://api.github.com/repos/StealthPad/Madness/deployments","created_at":"2018-07-20T21:04:31Z","updated_at":"2018-07-28T20:15:57Z","pushed_at":"2018-07-29T17:29:18Z","git_url":"git://github.com/StealthPad/Madness.git","ssh_url":"git@github.com:StealthPad/Madness.git","clone_url":"https://github.com/StealthPad/Madness.git","svn_url":"https://github.com/StealthPad/Madness","homepage":null,"size":49,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"StealthPad:master","ref":"master","sha":"b04593c5f673ca61edd670e15d3ec1e230e36b3f","user":{"login":"StealthPad","id":41490815,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNDkwODE1","avatar_url":"https://avatars0.githubusercontent.com/u/41490815?v=4","gravatar_id":"","url":"https://api.github.com/users/StealthPad","html_url":"https://github.com/StealthPad","followers_url":"https://api.github.com/users/StealthPad/followers","following_url":"https://api.github.com/users/StealthPad/following{/other_user}","gists_url":"https://api.github.com/users/StealthPad/gists{/gist_id}","starred_url":"https://api.github.com/users/StealthPad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StealthPad/subscriptions","organizations_url":"https://api.github.com/users/StealthPad/orgs","repos_url":"https://api.github.com/users/StealthPad/repos","events_url":"https://api.github.com/users/StealthPad/events{/privacy}","received_events_url":"https://api.github.com/users/StealthPad/received_events","type":"Organization","site_admin":false},"repo":{"id":141757784,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE3NTc3ODQ=","name":"Madness","full_name":"StealthPad/Madness","owner":{"login":"StealthPad","id":41490815,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNDkwODE1","avatar_url":"https://avatars0.githubusercontent.com/u/41490815?v=4","gravatar_id":"","url":"https://api.github.com/users/StealthPad","html_url":"https://github.com/StealthPad","followers_url":"https://api.github.com/users/StealthPad/followers","following_url":"https://api.github.com/users/StealthPad/following{/other_user}","gists_url":"https://api.github.com/users/StealthPad/gists{/gist_id}","starred_url":"https://api.github.com/users/StealthPad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StealthPad/subscriptions","organizations_url":"https://api.github.com/users/StealthPad/orgs","repos_url":"https://api.github.com/users/StealthPad/repos","events_url":"https://api.github.com/users/StealthPad/events{/privacy}","received_events_url":"https://api.github.com/users/StealthPad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StealthPad/Madness","description":"This is Madness.","fork":false,"url":"https://api.github.com/repos/StealthPad/Madness","forks_url":"https://api.github.com/repos/StealthPad/Madness/forks","keys_url":"https://api.github.com/repos/StealthPad/Madness/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StealthPad/Madness/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StealthPad/Madness/teams","hooks_url":"https://api.github.com/repos/StealthPad/Madness/hooks","issue_events_url":"https://api.github.com/repos/StealthPad/Madness/issues/events{/number}","events_url":"https://api.github.com/repos/StealthPad/Madness/events","assignees_url":"https://api.github.com/repos/StealthPad/Madness/assignees{/user}","branches_url":"https://api.github.com/repos/StealthPad/Madness/branches{/branch}","tags_url":"https://api.github.com/repos/StealthPad/Madness/tags","blobs_url":"https://api.github.com/repos/StealthPad/Madness/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StealthPad/Madness/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StealthPad/Madness/git/refs{/sha}","trees_url":"https://api.github.com/repos/StealthPad/Madness/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StealthPad/Madness/statuses/{sha}","languages_url":"https://api.github.com/repos/StealthPad/Madness/languages","stargazers_url":"https://api.github.com/repos/StealthPad/Madness/stargazers","contributors_url":"https://api.github.com/repos/StealthPad/Madness/contributors","subscribers_url":"https://api.github.com/repos/StealthPad/Madness/subscribers","subscription_url":"https://api.github.com/repos/StealthPad/Madness/subscription","commits_url":"https://api.github.com/repos/StealthPad/Madness/commits{/sha}","git_commits_url":"https://api.github.com/repos/StealthPad/Madness/git/commits{/sha}","comments_url":"https://api.github.com/repos/StealthPad/Madness/comments{/number}","issue_comment_url":"https://api.github.com/repos/StealthPad/Madness/issues/comments{/number}","contents_url":"https://api.github.com/repos/StealthPad/Madness/contents/{+path}","compare_url":"https://api.github.com/repos/StealthPad/Madness/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StealthPad/Madness/merges","archive_url":"https://api.github.com/repos/StealthPad/Madness/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StealthPad/Madness/downloads","issues_url":"https://api.github.com/repos/StealthPad/Madness/issues{/number}","pulls_url":"https://api.github.com/repos/StealthPad/Madness/pulls{/number}","milestones_url":"https://api.github.com/repos/StealthPad/Madness/milestones{/number}","notifications_url":"https://api.github.com/repos/StealthPad/Madness/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StealthPad/Madness/labels{/name}","releases_url":"https://api.github.com/repos/StealthPad/Madness/releases{/id}","deployments_url":"https://api.github.com/repos/StealthPad/Madness/deployments","created_at":"2018-07-20T21:04:31Z","updated_at":"2018-07-28T20:15:57Z","pushed_at":"2018-07-29T17:29:18Z","git_url":"git://github.com/StealthPad/Madness.git","ssh_url":"git@github.com:StealthPad/Madness.git","clone_url":"https://github.com/StealthPad/Madness.git","svn_url":"https://github.com/StealthPad/Madness","homepage":null,"size":49,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StealthPad/Madness/pulls/12"},"html":{"href":"https://github.com/StealthPad/Madness/pull/12"},"issue":{"href":"https://api.github.com/repos/StealthPad/Madness/issues/12"},"comments":{"href":"https://api.github.com/repos/StealthPad/Madness/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/StealthPad/Madness/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/StealthPad/Madness/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StealthPad/Madness/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/StealthPad/Madness/statuses/6038da0891940281fb3174e5fac2c6c9e432b437"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Davidde94"}}