{"action":"created","comment":{"url":"https://api.github.com/repos/square/sqlbrite/pulls/comments/38268567","id":38268567,"diff_hunk":"@@ -68,10 +71,31 @@ public BriteContentResolver wrapContentProvider(@NonNull ContentResolver content\n   }\n \n   /** An executable query. */\n-  public interface Query {\n+  public static abstract class Query {\n     /** Execute the query on the underlying database and return the resulting cursor. */\n     @CheckResult @WorkerThread\n-    Cursor run();\n+    public abstract Cursor run();\n+\n+    /**\n+     * Execute the query on the underlying database and return an Observable of the rows queried.\n+     *\n+     * @param map Takes in a cursor for a single row and maps it to your desired result type.\n+     */\n+    public <T> Observable<T> map(final Func1<Cursor, T> map) {\n+      return Observable.create(new Observable.OnSubscribe<T>() {\n+        @Override public void call(Subscriber<? super T> subscriber) {\n+          Cursor cursor = run();\n+          try {\n+            while (cursor.moveToNext()) {\n+              subscriber.onNext(map.call(cursor));\n+            }\n+            subscriber.onCompleted();","path":"sqlbrite/src/main/java/com/squareup/sqlbrite/SqlBrite.java","position":34,"original_position":34,"commit_id":"c5dcf95c759df2f50c07967080b8621caae84b89","original_commit_id":"c5dcf95c759df2f50c07967080b8621caae84b89","user":{"login":"JakeWharton","id":66577,"avatar_url":"https://avatars.githubusercontent.com/u/66577?v=3","gravatar_id":"","url":"https://api.github.com/users/JakeWharton","html_url":"https://github.com/JakeWharton","followers_url":"https://api.github.com/users/JakeWharton/followers","following_url":"https://api.github.com/users/JakeWharton/following{/other_user}","gists_url":"https://api.github.com/users/JakeWharton/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeWharton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeWharton/subscriptions","organizations_url":"https://api.github.com/users/JakeWharton/orgs","repos_url":"https://api.github.com/users/JakeWharton/repos","events_url":"https://api.github.com/users/JakeWharton/events{/privacy}","received_events_url":"https://api.github.com/users/JakeWharton/received_events","type":"User","site_admin":false},"body":"Call this outside the `try` so if `close()` throws it'll go to `onError`","created_at":"2015-08-30T04:58:23Z","updated_at":"2015-08-30T04:58:23Z","html_url":"https://github.com/square/sqlbrite/pull/45#discussion_r38268567","pull_request_url":"https://api.github.com/repos/square/sqlbrite/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/square/sqlbrite/pulls/comments/38268567"},"html":{"href":"https://github.com/square/sqlbrite/pull/45#discussion_r38268567"},"pull_request":{"href":"https://api.github.com/repos/square/sqlbrite/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/square/sqlbrite/pulls/45","id":43701427,"html_url":"https://github.com/square/sqlbrite/pull/45","diff_url":"https://github.com/square/sqlbrite/pull/45.diff","patch_url":"https://github.com/square/sqlbrite/pull/45.patch","issue_url":"https://api.github.com/repos/square/sqlbrite/issues/45","number":45,"state":"open","locked":false,"title":"Optionally map a SqlBrite.Query to an Observable","user":{"login":"AlecStrong","id":1675456,"avatar_url":"https://avatars.githubusercontent.com/u/1675456?v=3","gravatar_id":"","url":"https://api.github.com/users/AlecStrong","html_url":"https://github.com/AlecStrong","followers_url":"https://api.github.com/users/AlecStrong/followers","following_url":"https://api.github.com/users/AlecStrong/following{/other_user}","gists_url":"https://api.github.com/users/AlecStrong/gists{/gist_id}","starred_url":"https://api.github.com/users/AlecStrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlecStrong/subscriptions","organizations_url":"https://api.github.com/users/AlecStrong/orgs","repos_url":"https://api.github.com/users/AlecStrong/repos","events_url":"https://api.github.com/users/AlecStrong/events{/privacy}","received_events_url":"https://api.github.com/users/AlecStrong/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-29T20:29:50Z","updated_at":"2015-08-30T04:58:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7447a38523795a1a84e3e07b7e59e428ea9a25dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/square/sqlbrite/pulls/45/commits","review_comments_url":"https://api.github.com/repos/square/sqlbrite/pulls/45/comments","review_comment_url":"https://api.github.com/repos/square/sqlbrite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/square/sqlbrite/issues/45/comments","statuses_url":"https://api.github.com/repos/square/sqlbrite/statuses/c5dcf95c759df2f50c07967080b8621caae84b89","head":{"label":"AlecStrong:master","ref":"master","sha":"c5dcf95c759df2f50c07967080b8621caae84b89","user":{"login":"AlecStrong","id":1675456,"avatar_url":"https://avatars.githubusercontent.com/u/1675456?v=3","gravatar_id":"","url":"https://api.github.com/users/AlecStrong","html_url":"https://github.com/AlecStrong","followers_url":"https://api.github.com/users/AlecStrong/followers","following_url":"https://api.github.com/users/AlecStrong/following{/other_user}","gists_url":"https://api.github.com/users/AlecStrong/gists{/gist_id}","starred_url":"https://api.github.com/users/AlecStrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlecStrong/subscriptions","organizations_url":"https://api.github.com/users/AlecStrong/orgs","repos_url":"https://api.github.com/users/AlecStrong/repos","events_url":"https://api.github.com/users/AlecStrong/events{/privacy}","received_events_url":"https://api.github.com/users/AlecStrong/received_events","type":"User","site_admin":false},"repo":{"id":31044553,"name":"sqlbrite","full_name":"AlecStrong/sqlbrite","owner":{"login":"AlecStrong","id":1675456,"avatar_url":"https://avatars.githubusercontent.com/u/1675456?v=3","gravatar_id":"","url":"https://api.github.com/users/AlecStrong","html_url":"https://github.com/AlecStrong","followers_url":"https://api.github.com/users/AlecStrong/followers","following_url":"https://api.github.com/users/AlecStrong/following{/other_user}","gists_url":"https://api.github.com/users/AlecStrong/gists{/gist_id}","starred_url":"https://api.github.com/users/AlecStrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlecStrong/subscriptions","organizations_url":"https://api.github.com/users/AlecStrong/orgs","repos_url":"https://api.github.com/users/AlecStrong/repos","events_url":"https://api.github.com/users/AlecStrong/events{/privacy}","received_events_url":"https://api.github.com/users/AlecStrong/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlecStrong/sqlbrite","description":"A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations.","fork":true,"url":"https://api.github.com/repos/AlecStrong/sqlbrite","forks_url":"https://api.github.com/repos/AlecStrong/sqlbrite/forks","keys_url":"https://api.github.com/repos/AlecStrong/sqlbrite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlecStrong/sqlbrite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlecStrong/sqlbrite/teams","hooks_url":"https://api.github.com/repos/AlecStrong/sqlbrite/hooks","issue_events_url":"https://api.github.com/repos/AlecStrong/sqlbrite/issues/events{/number}","events_url":"https://api.github.com/repos/AlecStrong/sqlbrite/events","assignees_url":"https://api.github.com/repos/AlecStrong/sqlbrite/assignees{/user}","branches_url":"https://api.github.com/repos/AlecStrong/sqlbrite/branches{/branch}","tags_url":"https://api.github.com/repos/AlecStrong/sqlbrite/tags","blobs_url":"https://api.github.com/repos/AlecStrong/sqlbrite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlecStrong/sqlbrite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlecStrong/sqlbrite/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlecStrong/sqlbrite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlecStrong/sqlbrite/statuses/{sha}","languages_url":"https://api.github.com/repos/AlecStrong/sqlbrite/languages","stargazers_url":"https://api.github.com/repos/AlecStrong/sqlbrite/stargazers","contributors_url":"https://api.github.com/repos/AlecStrong/sqlbrite/contributors","subscribers_url":"https://api.github.com/repos/AlecStrong/sqlbrite/subscribers","subscription_url":"https://api.github.com/repos/AlecStrong/sqlbrite/subscription","commits_url":"https://api.github.com/repos/AlecStrong/sqlbrite/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlecStrong/sqlbrite/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlecStrong/sqlbrite/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlecStrong/sqlbrite/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlecStrong/sqlbrite/contents/{+path}","compare_url":"https://api.github.com/repos/AlecStrong/sqlbrite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlecStrong/sqlbrite/merges","archive_url":"https://api.github.com/repos/AlecStrong/sqlbrite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlecStrong/sqlbrite/downloads","issues_url":"https://api.github.com/repos/AlecStrong/sqlbrite/issues{/number}","pulls_url":"https://api.github.com/repos/AlecStrong/sqlbrite/pulls{/number}","milestones_url":"https://api.github.com/repos/AlecStrong/sqlbrite/milestones{/number}","notifications_url":"https://api.github.com/repos/AlecStrong/sqlbrite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlecStrong/sqlbrite/labels{/name}","releases_url":"https://api.github.com/repos/AlecStrong/sqlbrite/releases{/id}","created_at":"2015-02-20T00:30:22Z","updated_at":"2015-06-30T18:01:17Z","pushed_at":"2015-08-29T20:28:13Z","git_url":"git://github.com/AlecStrong/sqlbrite.git","ssh_url":"git@github.com:AlecStrong/sqlbrite.git","clone_url":"https://github.com/AlecStrong/sqlbrite.git","svn_url":"https://github.com/AlecStrong/sqlbrite","homepage":"","size":286,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"square:master","ref":"master","sha":"19a2e859527e5cd8a65bbabd5fd27aa2562871da","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":31001422,"name":"sqlbrite","full_name":"square/sqlbrite","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/sqlbrite","description":"A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations.","fork":false,"url":"https://api.github.com/repos/square/sqlbrite","forks_url":"https://api.github.com/repos/square/sqlbrite/forks","keys_url":"https://api.github.com/repos/square/sqlbrite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/sqlbrite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/sqlbrite/teams","hooks_url":"https://api.github.com/repos/square/sqlbrite/hooks","issue_events_url":"https://api.github.com/repos/square/sqlbrite/issues/events{/number}","events_url":"https://api.github.com/repos/square/sqlbrite/events","assignees_url":"https://api.github.com/repos/square/sqlbrite/assignees{/user}","branches_url":"https://api.github.com/repos/square/sqlbrite/branches{/branch}","tags_url":"https://api.github.com/repos/square/sqlbrite/tags","blobs_url":"https://api.github.com/repos/square/sqlbrite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/sqlbrite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/sqlbrite/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/sqlbrite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/sqlbrite/statuses/{sha}","languages_url":"https://api.github.com/repos/square/sqlbrite/languages","stargazers_url":"https://api.github.com/repos/square/sqlbrite/stargazers","contributors_url":"https://api.github.com/repos/square/sqlbrite/contributors","subscribers_url":"https://api.github.com/repos/square/sqlbrite/subscribers","subscription_url":"https://api.github.com/repos/square/sqlbrite/subscription","commits_url":"https://api.github.com/repos/square/sqlbrite/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/sqlbrite/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/sqlbrite/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/sqlbrite/issues/comments{/number}","contents_url":"https://api.github.com/repos/square/sqlbrite/contents/{+path}","compare_url":"https://api.github.com/repos/square/sqlbrite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/sqlbrite/merges","archive_url":"https://api.github.com/repos/square/sqlbrite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/sqlbrite/downloads","issues_url":"https://api.github.com/repos/square/sqlbrite/issues{/number}","pulls_url":"https://api.github.com/repos/square/sqlbrite/pulls{/number}","milestones_url":"https://api.github.com/repos/square/sqlbrite/milestones{/number}","notifications_url":"https://api.github.com/repos/square/sqlbrite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/sqlbrite/labels{/name}","releases_url":"https://api.github.com/repos/square/sqlbrite/releases{/id}","created_at":"2015-02-19T04:38:37Z","updated_at":"2015-08-29T17:33:37Z","pushed_at":"2015-08-29T20:29:50Z","git_url":"git://github.com/square/sqlbrite.git","ssh_url":"git@github.com:square/sqlbrite.git","clone_url":"https://github.com/square/sqlbrite.git","svn_url":"https://github.com/square/sqlbrite","homepage":"","size":539,"stargazers_count":1549,"watchers_count":1549,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":116,"mirror_url":null,"open_issues_count":10,"forks":116,"open_issues":10,"watchers":1549,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/square/sqlbrite/pulls/45"},"html":{"href":"https://github.com/square/sqlbrite/pull/45"},"issue":{"href":"https://api.github.com/repos/square/sqlbrite/issues/45"},"comments":{"href":"https://api.github.com/repos/square/sqlbrite/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/square/sqlbrite/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/square/sqlbrite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/square/sqlbrite/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/square/sqlbrite/statuses/c5dcf95c759df2f50c07967080b8621caae84b89"}}}}