{"action":"created","comment":{"url":"https://api.github.com/repos/wangkuiyi/ci/pulls/comments/91668538","pull_request_review_id":12178768,"id":91668538,"diff_hunk":"@@ -0,0 +1,324 @@\n+package db\n+\n+import (\n+\t\"bytes\"\n+\t\"encoding/binary\"\n+\t\"encoding/gob\"\n+\t\"errors\"\n+\n+\t\"fmt\"\n+\n+\t\"github.com/boltdb/bolt\"\n+)\n+\n+var (\n+\tbuildBucket   = []byte(\"build\")\n+\tpendingBucket = []byte(\"pending\")\n+\tstatusBucket  = []byte(\"status\")\n+\toutputBucket  = []byte(\"output\")\n+\tshaBucket     = []byte(\"sha\")\n+\trefBucket     = []byte(\"ref\")\n+)\n+\n+func validate(start, end int) error {\n+\tif start < 0 {\n+\t\treturn fmt.Errorf(\"invalid argument start: %d\", start)\n+\t}\n+\n+\tif end < -1 {\n+\t\treturn fmt.Errorf(\"invalid argument end: %d\", end)\n+\t} else if end >= 0 && start > end {\n+\t\treturn fmt.Errorf(\"invalid argument start: %d, end: %d\", start, end)\n+\t}\n+\n+\treturn nil\n+}\n+\n+// DB is the database api for ci system.\n+type DB struct {\n+\tdb *bolt.DB","path":"db/db.go","position":39,"original_position":39,"commit_id":"56c02b13f7b8c4eb3cc88ebb6ded64686edf59bb","original_commit_id":"ac8861ffbcd9fcd498abdc4d5259ba6caa675e09","user":{"login":"wangkuiyi","id":1548775,"avatar_url":"https://avatars.githubusercontent.com/u/1548775?v=3","gravatar_id":"","url":"https://api.github.com/users/wangkuiyi","html_url":"https://github.com/wangkuiyi","followers_url":"https://api.github.com/users/wangkuiyi/followers","following_url":"https://api.github.com/users/wangkuiyi/following{/other_user}","gists_url":"https://api.github.com/users/wangkuiyi/gists{/gist_id}","starred_url":"https://api.github.com/users/wangkuiyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangkuiyi/subscriptions","organizations_url":"https://api.github.com/users/wangkuiyi/orgs","repos_url":"https://api.github.com/users/wangkuiyi/repos","events_url":"https://api.github.com/users/wangkuiyi/events{/privacy}","received_events_url":"https://api.github.com/users/wangkuiyi/received_events","type":"User","site_admin":false},"body":"这里是不是可以写成\r\n\r\n```\r\ntype DB struct {\r\n    *bolt.DB\r\n}\r\n```\r\n\r\n这样下面的65处用法都可以简化。比如\r\n\r\n```\r\nerr := d.db.Update(\r\n```\r\n\r\n可以是\r\n\r\n```\r\nerr := d.Update(\r\n```","created_at":"2016-12-09T07:14:59Z","updated_at":"2016-12-09T07:42:34Z","html_url":"https://github.com/wangkuiyi/ci/pull/19#discussion_r91668538","pull_request_url":"https://api.github.com/repos/wangkuiyi/ci/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/wangkuiyi/ci/pulls/comments/91668538"},"html":{"href":"https://github.com/wangkuiyi/ci/pull/19#discussion_r91668538"},"pull_request":{"href":"https://api.github.com/repos/wangkuiyi/ci/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/wangkuiyi/ci/pulls/19","id":97259834,"html_url":"https://github.com/wangkuiyi/ci/pull/19","diff_url":"https://github.com/wangkuiyi/ci/pull/19.diff","patch_url":"https://github.com/wangkuiyi/ci/pull/19.patch","issue_url":"https://api.github.com/repos/wangkuiyi/ci/issues/19","number":19,"state":"open","locked":false,"title":"issue #18 change sql db to bolt db","user":{"login":"helinwang","id":1724178,"avatar_url":"https://avatars.githubusercontent.com/u/1724178?v=3","gravatar_id":"","url":"https://api.github.com/users/helinwang","html_url":"https://github.com/helinwang","followers_url":"https://api.github.com/users/helinwang/followers","following_url":"https://api.github.com/users/helinwang/following{/other_user}","gists_url":"https://api.github.com/users/helinwang/gists{/gist_id}","starred_url":"https://api.github.com/users/helinwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helinwang/subscriptions","organizations_url":"https://api.github.com/users/helinwang/orgs","repos_url":"https://api.github.com/users/helinwang/repos","events_url":"https://api.github.com/users/helinwang/events{/privacy}","received_events_url":"https://api.github.com/users/helinwang/received_events","type":"User","site_admin":false},"body":"this PR address issue #18 \r\npackage `db` has test coverage of 74.1%, other packages have no coverage yet.\r\n@reyoung @wangkuiyi ","created_at":"2016-12-09T06:54:11Z","updated_at":"2016-12-09T07:42:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d39d939574a74fd437848215e556e2527f86fa0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wangkuiyi/ci/pulls/19/commits","review_comments_url":"https://api.github.com/repos/wangkuiyi/ci/pulls/19/comments","review_comment_url":"https://api.github.com/repos/wangkuiyi/ci/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wangkuiyi/ci/issues/19/comments","statuses_url":"https://api.github.com/repos/wangkuiyi/ci/statuses/56c02b13f7b8c4eb3cc88ebb6ded64686edf59bb","head":{"label":"helinwang:develop","ref":"develop","sha":"56c02b13f7b8c4eb3cc88ebb6ded64686edf59bb","user":{"login":"helinwang","id":1724178,"avatar_url":"https://avatars.githubusercontent.com/u/1724178?v=3","gravatar_id":"","url":"https://api.github.com/users/helinwang","html_url":"https://github.com/helinwang","followers_url":"https://api.github.com/users/helinwang/followers","following_url":"https://api.github.com/users/helinwang/following{/other_user}","gists_url":"https://api.github.com/users/helinwang/gists{/gist_id}","starred_url":"https://api.github.com/users/helinwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helinwang/subscriptions","organizations_url":"https://api.github.com/users/helinwang/orgs","repos_url":"https://api.github.com/users/helinwang/repos","events_url":"https://api.github.com/users/helinwang/events{/privacy}","received_events_url":"https://api.github.com/users/helinwang/received_events","type":"User","site_admin":false},"repo":{"id":74425036,"name":"ci","full_name":"helinwang/ci","owner":{"login":"helinwang","id":1724178,"avatar_url":"https://avatars.githubusercontent.com/u/1724178?v=3","gravatar_id":"","url":"https://api.github.com/users/helinwang","html_url":"https://github.com/helinwang","followers_url":"https://api.github.com/users/helinwang/followers","following_url":"https://api.github.com/users/helinwang/following{/other_user}","gists_url":"https://api.github.com/users/helinwang/gists{/gist_id}","starred_url":"https://api.github.com/users/helinwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helinwang/subscriptions","organizations_url":"https://api.github.com/users/helinwang/orgs","repos_url":"https://api.github.com/users/helinwang/repos","events_url":"https://api.github.com/users/helinwang/events{/privacy}","received_events_url":"https://api.github.com/users/helinwang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/helinwang/ci","description":null,"fork":true,"url":"https://api.github.com/repos/helinwang/ci","forks_url":"https://api.github.com/repos/helinwang/ci/forks","keys_url":"https://api.github.com/repos/helinwang/ci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helinwang/ci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helinwang/ci/teams","hooks_url":"https://api.github.com/repos/helinwang/ci/hooks","issue_events_url":"https://api.github.com/repos/helinwang/ci/issues/events{/number}","events_url":"https://api.github.com/repos/helinwang/ci/events","assignees_url":"https://api.github.com/repos/helinwang/ci/assignees{/user}","branches_url":"https://api.github.com/repos/helinwang/ci/branches{/branch}","tags_url":"https://api.github.com/repos/helinwang/ci/tags","blobs_url":"https://api.github.com/repos/helinwang/ci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helinwang/ci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helinwang/ci/git/refs{/sha}","trees_url":"https://api.github.com/repos/helinwang/ci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helinwang/ci/statuses/{sha}","languages_url":"https://api.github.com/repos/helinwang/ci/languages","stargazers_url":"https://api.github.com/repos/helinwang/ci/stargazers","contributors_url":"https://api.github.com/repos/helinwang/ci/contributors","subscribers_url":"https://api.github.com/repos/helinwang/ci/subscribers","subscription_url":"https://api.github.com/repos/helinwang/ci/subscription","commits_url":"https://api.github.com/repos/helinwang/ci/commits{/sha}","git_commits_url":"https://api.github.com/repos/helinwang/ci/git/commits{/sha}","comments_url":"https://api.github.com/repos/helinwang/ci/comments{/number}","issue_comment_url":"https://api.github.com/repos/helinwang/ci/issues/comments{/number}","contents_url":"https://api.github.com/repos/helinwang/ci/contents/{+path}","compare_url":"https://api.github.com/repos/helinwang/ci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helinwang/ci/merges","archive_url":"https://api.github.com/repos/helinwang/ci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helinwang/ci/downloads","issues_url":"https://api.github.com/repos/helinwang/ci/issues{/number}","pulls_url":"https://api.github.com/repos/helinwang/ci/pulls{/number}","milestones_url":"https://api.github.com/repos/helinwang/ci/milestones{/number}","notifications_url":"https://api.github.com/repos/helinwang/ci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helinwang/ci/labels{/name}","releases_url":"https://api.github.com/repos/helinwang/ci/releases{/id}","deployments_url":"https://api.github.com/repos/helinwang/ci/deployments","created_at":"2016-11-22T02:15:16Z","updated_at":"2016-11-22T02:15:17Z","pushed_at":"2016-12-09T07:15:58Z","git_url":"git://github.com/helinwang/ci.git","ssh_url":"git@github.com:helinwang/ci.git","clone_url":"https://github.com/helinwang/ci.git","svn_url":"https://github.com/helinwang/ci","homepage":null,"size":311,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"wangkuiyi:develop","ref":"develop","sha":"49cd2c71711d73df818d92cb35c5ac2bcd7c5b14","user":{"login":"wangkuiyi","id":1548775,"avatar_url":"https://avatars.githubusercontent.com/u/1548775?v=3","gravatar_id":"","url":"https://api.github.com/users/wangkuiyi","html_url":"https://github.com/wangkuiyi","followers_url":"https://api.github.com/users/wangkuiyi/followers","following_url":"https://api.github.com/users/wangkuiyi/following{/other_user}","gists_url":"https://api.github.com/users/wangkuiyi/gists{/gist_id}","starred_url":"https://api.github.com/users/wangkuiyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangkuiyi/subscriptions","organizations_url":"https://api.github.com/users/wangkuiyi/orgs","repos_url":"https://api.github.com/users/wangkuiyi/repos","events_url":"https://api.github.com/users/wangkuiyi/events{/privacy}","received_events_url":"https://api.github.com/users/wangkuiyi/received_events","type":"User","site_admin":false},"repo":{"id":70202212,"name":"ci","full_name":"wangkuiyi/ci","owner":{"login":"wangkuiyi","id":1548775,"avatar_url":"https://avatars.githubusercontent.com/u/1548775?v=3","gravatar_id":"","url":"https://api.github.com/users/wangkuiyi","html_url":"https://github.com/wangkuiyi","followers_url":"https://api.github.com/users/wangkuiyi/followers","following_url":"https://api.github.com/users/wangkuiyi/following{/other_user}","gists_url":"https://api.github.com/users/wangkuiyi/gists{/gist_id}","starred_url":"https://api.github.com/users/wangkuiyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangkuiyi/subscriptions","organizations_url":"https://api.github.com/users/wangkuiyi/orgs","repos_url":"https://api.github.com/users/wangkuiyi/repos","events_url":"https://api.github.com/users/wangkuiyi/events{/privacy}","received_events_url":"https://api.github.com/users/wangkuiyi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wangkuiyi/ci","description":null,"fork":false,"url":"https://api.github.com/repos/wangkuiyi/ci","forks_url":"https://api.github.com/repos/wangkuiyi/ci/forks","keys_url":"https://api.github.com/repos/wangkuiyi/ci/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wangkuiyi/ci/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wangkuiyi/ci/teams","hooks_url":"https://api.github.com/repos/wangkuiyi/ci/hooks","issue_events_url":"https://api.github.com/repos/wangkuiyi/ci/issues/events{/number}","events_url":"https://api.github.com/repos/wangkuiyi/ci/events","assignees_url":"https://api.github.com/repos/wangkuiyi/ci/assignees{/user}","branches_url":"https://api.github.com/repos/wangkuiyi/ci/branches{/branch}","tags_url":"https://api.github.com/repos/wangkuiyi/ci/tags","blobs_url":"https://api.github.com/repos/wangkuiyi/ci/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wangkuiyi/ci/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wangkuiyi/ci/git/refs{/sha}","trees_url":"https://api.github.com/repos/wangkuiyi/ci/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wangkuiyi/ci/statuses/{sha}","languages_url":"https://api.github.com/repos/wangkuiyi/ci/languages","stargazers_url":"https://api.github.com/repos/wangkuiyi/ci/stargazers","contributors_url":"https://api.github.com/repos/wangkuiyi/ci/contributors","subscribers_url":"https://api.github.com/repos/wangkuiyi/ci/subscribers","subscription_url":"https://api.github.com/repos/wangkuiyi/ci/subscription","commits_url":"https://api.github.com/repos/wangkuiyi/ci/commits{/sha}","git_commits_url":"https://api.github.com/repos/wangkuiyi/ci/git/commits{/sha}","comments_url":"https://api.github.com/repos/wangkuiyi/ci/comments{/number}","issue_comment_url":"https://api.github.com/repos/wangkuiyi/ci/issues/comments{/number}","contents_url":"https://api.github.com/repos/wangkuiyi/ci/contents/{+path}","compare_url":"https://api.github.com/repos/wangkuiyi/ci/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wangkuiyi/ci/merges","archive_url":"https://api.github.com/repos/wangkuiyi/ci/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wangkuiyi/ci/downloads","issues_url":"https://api.github.com/repos/wangkuiyi/ci/issues{/number}","pulls_url":"https://api.github.com/repos/wangkuiyi/ci/pulls{/number}","milestones_url":"https://api.github.com/repos/wangkuiyi/ci/milestones{/number}","notifications_url":"https://api.github.com/repos/wangkuiyi/ci/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wangkuiyi/ci/labels{/name}","releases_url":"https://api.github.com/repos/wangkuiyi/ci/releases{/id}","deployments_url":"https://api.github.com/repos/wangkuiyi/ci/deployments","created_at":"2016-10-06T23:57:27Z","updated_at":"2016-10-26T05:46:25Z","pushed_at":"2016-12-09T07:15:59Z","git_url":"git://github.com/wangkuiyi/ci.git","ssh_url":"git@github.com:wangkuiyi/ci.git","clone_url":"https://github.com/wangkuiyi/ci.git","svn_url":"https://github.com/wangkuiyi/ci","homepage":null,"size":305,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":10,"forks":3,"open_issues":10,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/wangkuiyi/ci/pulls/19"},"html":{"href":"https://github.com/wangkuiyi/ci/pull/19"},"issue":{"href":"https://api.github.com/repos/wangkuiyi/ci/issues/19"},"comments":{"href":"https://api.github.com/repos/wangkuiyi/ci/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/wangkuiyi/ci/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/wangkuiyi/ci/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wangkuiyi/ci/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/wangkuiyi/ci/statuses/56c02b13f7b8c4eb3cc88ebb6ded64686edf59bb"}}}}
{"actor":{"display_login":"wangkuiyi"}}