{"action":"created","comment":{"url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/comments/198621797","pull_request_review_id":132585326,"id":198621797,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODYyMTc5Nw==","diff_hunk":"@@ -41,9 +41,14 @@ func FromContext(ctx context.Context) (txn *Transaction, ok bool) {\n // It works as a singleton to prevent an application of creating more than one\n // transaction instance per incoming request.\n type Transaction struct {\n-\tmu      sync.Mutex\n-\tparent  *gorm.DB\n-\tcurrent *gorm.DB\n+\tmu           sync.Mutex\n+\tparent       *gorm.DB\n+\tcurrent      *gorm.DB\n+\tOnCommitHook func(ctx context.Context)","path":"gorm/transaction.go","position":10,"original_position":10,"commit_id":"02445881f80d14b12e73b83de0802cf4ba9763b9","original_commit_id":"02445881f80d14b12e73b83de0802cf4ba9763b9","user":{"login":"dmacthedestroyer","id":334661,"node_id":"MDQ6VXNlcjMzNDY2MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/334661?v=4","gravatar_id":"","url":"https://api.github.com/users/dmacthedestroyer","html_url":"https://github.com/dmacthedestroyer","followers_url":"https://api.github.com/users/dmacthedestroyer/followers","following_url":"https://api.github.com/users/dmacthedestroyer/following{/other_user}","gists_url":"https://api.github.com/users/dmacthedestroyer/gists{/gist_id}","starred_url":"https://api.github.com/users/dmacthedestroyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmacthedestroyer/subscriptions","organizations_url":"https://api.github.com/users/dmacthedestroyer/orgs","repos_url":"https://api.github.com/users/dmacthedestroyer/repos","events_url":"https://api.github.com/users/dmacthedestroyer/events{/privacy}","received_events_url":"https://api.github.com/users/dmacthedestroyer/received_events","type":"User","site_admin":false},"body":"let's make this unexportable (`onCommitHook`), and also make it a slice of `func(context.Context)` instead of a single hook. That way you can have multiple callbacks if needed","created_at":"2018-06-27T19:58:52Z","updated_at":"2018-06-27T20:01:36Z","html_url":"https://github.com/infobloxopen/atlas-app-toolkit/pull/61#discussion_r198621797","pull_request_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/comments/198621797"},"html":{"href":"https://github.com/infobloxopen/atlas-app-toolkit/pull/61#discussion_r198621797"},"pull_request":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61","id":197833684,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3ODMzNjg0","html_url":"https://github.com/infobloxopen/atlas-app-toolkit/pull/61","diff_url":"https://github.com/infobloxopen/atlas-app-toolkit/pull/61.diff","patch_url":"https://github.com/infobloxopen/atlas-app-toolkit/pull/61.patch","issue_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues/61","number":61,"state":"open","locked":false,"title":"Add transaction hook","user":{"login":"friahi65","id":5551858,"node_id":"MDQ6VXNlcjU1NTE4NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/5551858?v=4","gravatar_id":"","url":"https://api.github.com/users/friahi65","html_url":"https://github.com/friahi65","followers_url":"https://api.github.com/users/friahi65/followers","following_url":"https://api.github.com/users/friahi65/following{/other_user}","gists_url":"https://api.github.com/users/friahi65/gists{/gist_id}","starred_url":"https://api.github.com/users/friahi65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friahi65/subscriptions","organizations_url":"https://api.github.com/users/friahi65/orgs","repos_url":"https://api.github.com/users/friahi65/repos","events_url":"https://api.github.com/users/friahi65/events{/privacy}","received_events_url":"https://api.github.com/users/friahi65/received_events","type":"User","site_admin":false},"body":"- N* applications need to send notifications to another service about modified objects in a course of a request. We need to trigger the notification only when the transaction commits. \r\n- Adding a hook to toolkit transaction was an option that was discussed  in the team and in the toolkit scrum.\r\n- The hook was added as part of transaction struct, it can be set by the applications.\r\n- We need the context in the transaciton, so other middleware can put information about actual changes here. \r\n- Here is a link to an example on how this hook can be used in the application.\r\nhttps://github.com/Infoblox-CTO/ddi.dns.config/compare/toolkit...friahi65:TK-45717-Design\r\n","created_at":"2018-06-27T19:44:16Z","updated_at":"2018-06-27T20:01:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c433ba1b74e37471522c1152ca895a25afa9285","assignee":null,"assignees":[],"requested_reviewers":[{"login":"Calebjh","id":10749034,"node_id":"MDQ6VXNlcjEwNzQ5MDM0","avatar_url":"https://avatars3.githubusercontent.com/u/10749034?v=4","gravatar_id":"","url":"https://api.github.com/users/Calebjh","html_url":"https://github.com/Calebjh","followers_url":"https://api.github.com/users/Calebjh/followers","following_url":"https://api.github.com/users/Calebjh/following{/other_user}","gists_url":"https://api.github.com/users/Calebjh/gists{/gist_id}","starred_url":"https://api.github.com/users/Calebjh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Calebjh/subscriptions","organizations_url":"https://api.github.com/users/Calebjh/orgs","repos_url":"https://api.github.com/users/Calebjh/repos","events_url":"https://api.github.com/users/Calebjh/events{/privacy}","received_events_url":"https://api.github.com/users/Calebjh/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61/commits","review_comments_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61/comments","review_comment_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues/61/comments","statuses_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/statuses/02445881f80d14b12e73b83de0802cf4ba9763b9","head":{"label":"friahi65:Transaction-OnCommitHook","ref":"Transaction-OnCommitHook","sha":"02445881f80d14b12e73b83de0802cf4ba9763b9","user":{"login":"friahi65","id":5551858,"node_id":"MDQ6VXNlcjU1NTE4NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/5551858?v=4","gravatar_id":"","url":"https://api.github.com/users/friahi65","html_url":"https://github.com/friahi65","followers_url":"https://api.github.com/users/friahi65/followers","following_url":"https://api.github.com/users/friahi65/following{/other_user}","gists_url":"https://api.github.com/users/friahi65/gists{/gist_id}","starred_url":"https://api.github.com/users/friahi65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friahi65/subscriptions","organizations_url":"https://api.github.com/users/friahi65/orgs","repos_url":"https://api.github.com/users/friahi65/repos","events_url":"https://api.github.com/users/friahi65/events{/privacy}","received_events_url":"https://api.github.com/users/friahi65/received_events","type":"User","site_admin":false},"repo":{"id":138920512,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg5MjA1MTI=","name":"atlas-app-toolkit","full_name":"friahi65/atlas-app-toolkit","owner":{"login":"friahi65","id":5551858,"node_id":"MDQ6VXNlcjU1NTE4NTg=","avatar_url":"https://avatars1.githubusercontent.com/u/5551858?v=4","gravatar_id":"","url":"https://api.github.com/users/friahi65","html_url":"https://github.com/friahi65","followers_url":"https://api.github.com/users/friahi65/followers","following_url":"https://api.github.com/users/friahi65/following{/other_user}","gists_url":"https://api.github.com/users/friahi65/gists{/gist_id}","starred_url":"https://api.github.com/users/friahi65/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friahi65/subscriptions","organizations_url":"https://api.github.com/users/friahi65/orgs","repos_url":"https://api.github.com/users/friahi65/repos","events_url":"https://api.github.com/users/friahi65/events{/privacy}","received_events_url":"https://api.github.com/users/friahi65/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/friahi65/atlas-app-toolkit","description":null,"fork":true,"url":"https://api.github.com/repos/friahi65/atlas-app-toolkit","forks_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/forks","keys_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/teams","hooks_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/hooks","issue_events_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/issues/events{/number}","events_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/events","assignees_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/assignees{/user}","branches_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/branches{/branch}","tags_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/tags","blobs_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/statuses/{sha}","languages_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/languages","stargazers_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/stargazers","contributors_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/contributors","subscribers_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/subscribers","subscription_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/subscription","commits_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/contents/{+path}","compare_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/merges","archive_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/downloads","issues_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/issues{/number}","pulls_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/pulls{/number}","milestones_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/milestones{/number}","notifications_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/labels{/name}","releases_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/releases{/id}","deployments_url":"https://api.github.com/repos/friahi65/atlas-app-toolkit/deployments","created_at":"2018-06-27T18:45:33Z","updated_at":"2018-06-27T18:45:35Z","pushed_at":"2018-06-27T19:32:27Z","git_url":"git://github.com/friahi65/atlas-app-toolkit.git","ssh_url":"git@github.com:friahi65/atlas-app-toolkit.git","clone_url":"https://github.com/friahi65/atlas-app-toolkit.git","svn_url":"https://github.com/friahi65/atlas-app-toolkit","homepage":null,"size":414,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"infobloxopen:master","ref":"master","sha":"1498dd01b71c7ef524204741041ae42c77e8c60e","user":{"login":"infobloxopen","id":8064882,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNjQ4ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/8064882?v=4","gravatar_id":"","url":"https://api.github.com/users/infobloxopen","html_url":"https://github.com/infobloxopen","followers_url":"https://api.github.com/users/infobloxopen/followers","following_url":"https://api.github.com/users/infobloxopen/following{/other_user}","gists_url":"https://api.github.com/users/infobloxopen/gists{/gist_id}","starred_url":"https://api.github.com/users/infobloxopen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infobloxopen/subscriptions","organizations_url":"https://api.github.com/users/infobloxopen/orgs","repos_url":"https://api.github.com/users/infobloxopen/repos","events_url":"https://api.github.com/users/infobloxopen/events{/privacy}","received_events_url":"https://api.github.com/users/infobloxopen/received_events","type":"Organization","site_admin":false},"repo":{"id":126091108,"node_id":"MDEwOlJlcG9zaXRvcnkxMjYwOTExMDg=","name":"atlas-app-toolkit","full_name":"infobloxopen/atlas-app-toolkit","owner":{"login":"infobloxopen","id":8064882,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNjQ4ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/8064882?v=4","gravatar_id":"","url":"https://api.github.com/users/infobloxopen","html_url":"https://github.com/infobloxopen","followers_url":"https://api.github.com/users/infobloxopen/followers","following_url":"https://api.github.com/users/infobloxopen/following{/other_user}","gists_url":"https://api.github.com/users/infobloxopen/gists{/gist_id}","starred_url":"https://api.github.com/users/infobloxopen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infobloxopen/subscriptions","organizations_url":"https://api.github.com/users/infobloxopen/orgs","repos_url":"https://api.github.com/users/infobloxopen/repos","events_url":"https://api.github.com/users/infobloxopen/events{/privacy}","received_events_url":"https://api.github.com/users/infobloxopen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/infobloxopen/atlas-app-toolkit","description":null,"fork":false,"url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit","forks_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/forks","keys_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/teams","hooks_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/hooks","issue_events_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues/events{/number}","events_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/events","assignees_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/assignees{/user}","branches_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/branches{/branch}","tags_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/tags","blobs_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/statuses/{sha}","languages_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/languages","stargazers_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/stargazers","contributors_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/contributors","subscribers_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/subscribers","subscription_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/subscription","commits_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/contents/{+path}","compare_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/merges","archive_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/downloads","issues_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues{/number}","pulls_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls{/number}","milestones_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/milestones{/number}","notifications_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/labels{/name}","releases_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/releases{/id}","deployments_url":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/deployments","created_at":"2018-03-20T22:33:15Z","updated_at":"2018-06-25T16:07:19Z","pushed_at":"2018-06-27T19:44:17Z","git_url":"git://github.com/infobloxopen/atlas-app-toolkit.git","ssh_url":"git@github.com:infobloxopen/atlas-app-toolkit.git","clone_url":"https://github.com/infobloxopen/atlas-app-toolkit.git","svn_url":"https://github.com/infobloxopen/atlas-app-toolkit","homepage":null,"size":414,"stargazers_count":3,"watchers_count":3,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16,"open_issues":11,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61"},"html":{"href":"https://github.com/infobloxopen/atlas-app-toolkit/pull/61"},"issue":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues/61"},"comments":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/infobloxopen/atlas-app-toolkit/statuses/02445881f80d14b12e73b83de0802cf4ba9763b9"}},"author_association":"NONE"}}
{"actor":{"display_login":"dmacthedestroyer"}}