{"action":"created","comment":{"url":"https://api.github.com/repos/outr/scalarelational/pulls/comments/45052579","id":45052579,"diff_hunk":"@@ -13,53 +13,40 @@ import scala.language.existentials\n /**\n  * @author Matt Hicks <matt@outr.com>\n  */\n-case class Query[Expressions, Result](expressions: Expressions,\n-                                      table: Table = null,\n-                                      joins: List[Join] = Nil,\n-                                      whereCondition: Condition = null,\n-                                      grouping: List[SelectExpression[_]] = Nil,\n-                                      ordering: List[OrderBy[_]] = Nil,\n-                                      resultLimit: Int = -1,\n-                                      resultOffset: Int = -1,\n-                                      converter: QueryResult[Result] => Result,\n-                                      alias: Option[String] = None)\n-                                     (implicit val vectorify: Expressions => Vector[SelectExpression[_]]) extends WhereSupport[Query[Expressions, Result]] with Joinable {\n-  lazy val asVector = vectorify(expressions)\n-\n+case class Query[Types, Result](expressions: SelectExpressions[Types],\n+                                table: Table = null,\n+                                joins: List[Join] = Nil,\n+                                whereCondition: Condition = null,\n+                                grouping: List[SelectExpression[_]] = Nil,\n+                                ordering: List[OrderBy[_]] = Nil,\n+                                resultLimit: Int = -1,\n+                                resultOffset: Int = -1,\n+                                converter: QueryResult => Result,\n+                                alias: Option[String] = None) extends WhereSupport[Query[Types, Result]]\n+                                                              with Joinable\n+                                                              with JoinSupport[Types, Result] {\n   def apply[T, S](column: ColumnLike[T, S]) = ColumnAlias[T, S](column, alias, None, None)\n \n-  def fields(expressions: SelectExpression[_]*) = copy[Vector[SelectExpression[_]], QueryResult[_]](expressions = asVector ++ expressions, converter = DSLSupport.DefaultConverter)\n-  def fields(expressions: Vector[SelectExpression[_]]) = copy[Vector[SelectExpression[_]], QueryResult[_]](expressions = this.expressions ++ expressions, converter = DSLSupport.DefaultConverter)\n-  def withoutField(expression: SelectExpression[_]) = copy[Vector[SelectExpression[_]], QueryResult[_]](expressions = expressions.filterNot(se => se == expression), converter = DSLSupport.DefaultConverter)\n-  def clearFields() = copy[Vector[SelectExpression[_]], QueryResult[_]](expressions = Vector.empty, converter = DSLSupport.DefaultConverter)\n-\n-  def from(table: Table) = copy[Expressions, Result](table = table)\n-  def where(condition: Condition) = copy[Expressions, Result](whereCondition = condition)\n+  def where(condition: Condition) = copy[Types, Result](whereCondition = condition)\n \n-  def join(joinable: Joinable, joinType: JoinType = JoinType.Join) = PartialJoin[Expressions, Result](this, joinable, joinType)\n-  def innerJoin(joinable: Joinable) = join(joinable, joinType = JoinType.Inner)\n-  def leftJoin(joinable: Joinable) = join(joinable, joinType = JoinType.Left)\n-  def leftOuterJoin(joinable: Joinable) = join(joinable, joinType = JoinType.LeftOuter)\n+  def limit(value: Int) = copy[Types, Result](resultLimit = value)\n+  def offset(value: Int) = copy[Types, Result](resultOffset = value)\n \n-  def limit(value: Int) = copy[Expressions, Result](resultLimit = value)\n-  def offset(value: Int) = copy[Expressions, Result](resultOffset = value)\n-\n-  def groupBy(expressions: SelectExpression[_]*) = copy[Expressions, Result](grouping = grouping ::: expressions.toList)\n-  def orderBy(entries: OrderBy[_]*) = copy[Expressions, Result](ordering = entries.toList ::: ordering)\n+  def groupBy(expressions: SelectExpression[_]*) = copy[Types, Result](grouping = grouping ::: expressions.toList)\n+  def orderBy(entries: OrderBy[_]*) = copy[Types, Result](ordering = entries.toList ::: ordering)\n \n   def as(alias: String) = copy(alias = Option(alias))\n \n-  def convert[NewResult](converter: QueryResult[NewResult] => NewResult) = copy[Expressions, NewResult](converter = converter)\n-  def map[NewResult](converter: Result => NewResult) = {\n-    copy[Expressions, NewResult](converter = (qr: QueryResult[NewResult]) => converter(this.converter(qr.asInstanceOf[QueryResult[Result]])))\n-  }\n+  def map[NewResult](converter: Result => NewResult) = copy[Types, NewResult](converter = this.converter.andThen(converter))\n+  def convert[NewResult](converter: QueryResult => NewResult) = copy[Types, NewResult](converter = converter)","path":"core/src/main/scala/org/scalarelational/instruction/Query.scala","position":74,"original_position":74,"commit_id":"4e73626c0d960117f1659d869f60593067bada46","original_commit_id":"4e73626c0d960117f1659d869f60593067bada46","user":{"login":"tindzk","id":196819,"avatar_url":"https://avatars.githubusercontent.com/u/196819?v=3","gravatar_id":"","url":"https://api.github.com/users/tindzk","html_url":"https://github.com/tindzk","followers_url":"https://api.github.com/users/tindzk/followers","following_url":"https://api.github.com/users/tindzk/following{/other_user}","gists_url":"https://api.github.com/users/tindzk/gists{/gist_id}","starred_url":"https://api.github.com/users/tindzk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tindzk/subscriptions","organizations_url":"https://api.github.com/users/tindzk/orgs","repos_url":"https://api.github.com/users/tindzk/repos","events_url":"https://api.github.com/users/tindzk/events{/privacy}","received_events_url":"https://api.github.com/users/tindzk/received_events","type":"User","site_admin":false},"body":"What is the difference between `map` and `convert`? We should give examples in the manual.","created_at":"2015-11-17T12:15:13Z","updated_at":"2015-11-17T12:15:13Z","html_url":"https://github.com/outr/scalarelational/pull/67#discussion_r45052579","pull_request_url":"https://api.github.com/repos/outr/scalarelational/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/outr/scalarelational/pulls/comments/45052579"},"html":{"href":"https://github.com/outr/scalarelational/pull/67#discussion_r45052579"},"pull_request":{"href":"https://api.github.com/repos/outr/scalarelational/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/outr/scalarelational/pulls/67","id":50692920,"html_url":"https://github.com/outr/scalarelational/pull/67","diff_url":"https://github.com/outr/scalarelational/pull/67.diff","patch_url":"https://github.com/outr/scalarelational/pull/67.patch","issue_url":"https://api.github.com/repos/outr/scalarelational/issues/67","number":67,"state":"closed","locked":false,"title":"Query updates","user":{"login":"darkfrog26","id":877534,"avatar_url":"https://avatars.githubusercontent.com/u/877534?v=3","gravatar_id":"","url":"https://api.github.com/users/darkfrog26","html_url":"https://github.com/darkfrog26","followers_url":"https://api.github.com/users/darkfrog26/followers","following_url":"https://api.github.com/users/darkfrog26/following{/other_user}","gists_url":"https://api.github.com/users/darkfrog26/gists{/gist_id}","starred_url":"https://api.github.com/users/darkfrog26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkfrog26/subscriptions","organizations_url":"https://api.github.com/users/darkfrog26/orgs","repos_url":"https://api.github.com/users/darkfrog26/repos","events_url":"https://api.github.com/users/darkfrog26/events{/privacy}","received_events_url":"https://api.github.com/users/darkfrog26/received_events","type":"User","site_admin":false},"body":"Somewhat simplifies the query structure and creates a `converted` method along-side `result` in `Query`. I'm open to an alternative naming convention.","created_at":"2015-11-13T21:16:36Z","updated_at":"2015-11-17T12:15:13Z","closed_at":"2015-11-14T22:36:09Z","merged_at":"2015-11-14T22:36:09Z","merge_commit_sha":"fbb673c95e12b090a9dd0fca268e3ccc421eaf14","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/outr/scalarelational/pulls/67/commits","review_comments_url":"https://api.github.com/repos/outr/scalarelational/pulls/67/comments","review_comment_url":"https://api.github.com/repos/outr/scalarelational/pulls/comments{/number}","comments_url":"https://api.github.com/repos/outr/scalarelational/issues/67/comments","statuses_url":"https://api.github.com/repos/outr/scalarelational/statuses/4e73626c0d960117f1659d869f60593067bada46","head":{"label":"outr:query_updates","ref":"query_updates","sha":"4e73626c0d960117f1659d869f60593067bada46","user":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"repo":{"id":14048773,"name":"scalarelational","full_name":"outr/scalarelational","owner":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/outr/scalarelational","description":"Type-Safe framework for defining, modifying, and querying SQL databases","fork":false,"url":"https://api.github.com/repos/outr/scalarelational","forks_url":"https://api.github.com/repos/outr/scalarelational/forks","keys_url":"https://api.github.com/repos/outr/scalarelational/keys{/key_id}","collaborators_url":"https://api.github.com/repos/outr/scalarelational/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/outr/scalarelational/teams","hooks_url":"https://api.github.com/repos/outr/scalarelational/hooks","issue_events_url":"https://api.github.com/repos/outr/scalarelational/issues/events{/number}","events_url":"https://api.github.com/repos/outr/scalarelational/events","assignees_url":"https://api.github.com/repos/outr/scalarelational/assignees{/user}","branches_url":"https://api.github.com/repos/outr/scalarelational/branches{/branch}","tags_url":"https://api.github.com/repos/outr/scalarelational/tags","blobs_url":"https://api.github.com/repos/outr/scalarelational/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/outr/scalarelational/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/outr/scalarelational/git/refs{/sha}","trees_url":"https://api.github.com/repos/outr/scalarelational/git/trees{/sha}","statuses_url":"https://api.github.com/repos/outr/scalarelational/statuses/{sha}","languages_url":"https://api.github.com/repos/outr/scalarelational/languages","stargazers_url":"https://api.github.com/repos/outr/scalarelational/stargazers","contributors_url":"https://api.github.com/repos/outr/scalarelational/contributors","subscribers_url":"https://api.github.com/repos/outr/scalarelational/subscribers","subscription_url":"https://api.github.com/repos/outr/scalarelational/subscription","commits_url":"https://api.github.com/repos/outr/scalarelational/commits{/sha}","git_commits_url":"https://api.github.com/repos/outr/scalarelational/git/commits{/sha}","comments_url":"https://api.github.com/repos/outr/scalarelational/comments{/number}","issue_comment_url":"https://api.github.com/repos/outr/scalarelational/issues/comments{/number}","contents_url":"https://api.github.com/repos/outr/scalarelational/contents/{+path}","compare_url":"https://api.github.com/repos/outr/scalarelational/compare/{base}...{head}","merges_url":"https://api.github.com/repos/outr/scalarelational/merges","archive_url":"https://api.github.com/repos/outr/scalarelational/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/outr/scalarelational/downloads","issues_url":"https://api.github.com/repos/outr/scalarelational/issues{/number}","pulls_url":"https://api.github.com/repos/outr/scalarelational/pulls{/number}","milestones_url":"https://api.github.com/repos/outr/scalarelational/milestones{/number}","notifications_url":"https://api.github.com/repos/outr/scalarelational/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/outr/scalarelational/labels{/name}","releases_url":"https://api.github.com/repos/outr/scalarelational/releases{/id}","created_at":"2013-11-01T17:14:15Z","updated_at":"2015-10-01T20:08:20Z","pushed_at":"2015-11-14T23:47:39Z","git_url":"git://github.com/outr/scalarelational.git","ssh_url":"git@github.com:outr/scalarelational.git","clone_url":"https://github.com/outr/scalarelational.git","svn_url":"https://github.com/outr/scalarelational","homepage":null,"size":1727,"stargazers_count":27,"watchers_count":27,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":8,"forks":9,"open_issues":8,"watchers":27,"default_branch":"master"}},"base":{"label":"outr:master","ref":"master","sha":"0ceb396914db8c90c3ae0dbeac958aed33257a3c","user":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"repo":{"id":14048773,"name":"scalarelational","full_name":"outr/scalarelational","owner":{"login":"outr","id":5854353,"avatar_url":"https://avatars.githubusercontent.com/u/5854353?v=3","gravatar_id":"","url":"https://api.github.com/users/outr","html_url":"https://github.com/outr","followers_url":"https://api.github.com/users/outr/followers","following_url":"https://api.github.com/users/outr/following{/other_user}","gists_url":"https://api.github.com/users/outr/gists{/gist_id}","starred_url":"https://api.github.com/users/outr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outr/subscriptions","organizations_url":"https://api.github.com/users/outr/orgs","repos_url":"https://api.github.com/users/outr/repos","events_url":"https://api.github.com/users/outr/events{/privacy}","received_events_url":"https://api.github.com/users/outr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/outr/scalarelational","description":"Type-Safe framework for defining, modifying, and querying SQL databases","fork":false,"url":"https://api.github.com/repos/outr/scalarelational","forks_url":"https://api.github.com/repos/outr/scalarelational/forks","keys_url":"https://api.github.com/repos/outr/scalarelational/keys{/key_id}","collaborators_url":"https://api.github.com/repos/outr/scalarelational/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/outr/scalarelational/teams","hooks_url":"https://api.github.com/repos/outr/scalarelational/hooks","issue_events_url":"https://api.github.com/repos/outr/scalarelational/issues/events{/number}","events_url":"https://api.github.com/repos/outr/scalarelational/events","assignees_url":"https://api.github.com/repos/outr/scalarelational/assignees{/user}","branches_url":"https://api.github.com/repos/outr/scalarelational/branches{/branch}","tags_url":"https://api.github.com/repos/outr/scalarelational/tags","blobs_url":"https://api.github.com/repos/outr/scalarelational/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/outr/scalarelational/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/outr/scalarelational/git/refs{/sha}","trees_url":"https://api.github.com/repos/outr/scalarelational/git/trees{/sha}","statuses_url":"https://api.github.com/repos/outr/scalarelational/statuses/{sha}","languages_url":"https://api.github.com/repos/outr/scalarelational/languages","stargazers_url":"https://api.github.com/repos/outr/scalarelational/stargazers","contributors_url":"https://api.github.com/repos/outr/scalarelational/contributors","subscribers_url":"https://api.github.com/repos/outr/scalarelational/subscribers","subscription_url":"https://api.github.com/repos/outr/scalarelational/subscription","commits_url":"https://api.github.com/repos/outr/scalarelational/commits{/sha}","git_commits_url":"https://api.github.com/repos/outr/scalarelational/git/commits{/sha}","comments_url":"https://api.github.com/repos/outr/scalarelational/comments{/number}","issue_comment_url":"https://api.github.com/repos/outr/scalarelational/issues/comments{/number}","contents_url":"https://api.github.com/repos/outr/scalarelational/contents/{+path}","compare_url":"https://api.github.com/repos/outr/scalarelational/compare/{base}...{head}","merges_url":"https://api.github.com/repos/outr/scalarelational/merges","archive_url":"https://api.github.com/repos/outr/scalarelational/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/outr/scalarelational/downloads","issues_url":"https://api.github.com/repos/outr/scalarelational/issues{/number}","pulls_url":"https://api.github.com/repos/outr/scalarelational/pulls{/number}","milestones_url":"https://api.github.com/repos/outr/scalarelational/milestones{/number}","notifications_url":"https://api.github.com/repos/outr/scalarelational/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/outr/scalarelational/labels{/name}","releases_url":"https://api.github.com/repos/outr/scalarelational/releases{/id}","created_at":"2013-11-01T17:14:15Z","updated_at":"2015-10-01T20:08:20Z","pushed_at":"2015-11-14T23:47:39Z","git_url":"git://github.com/outr/scalarelational.git","ssh_url":"git@github.com:outr/scalarelational.git","clone_url":"https://github.com/outr/scalarelational.git","svn_url":"https://github.com/outr/scalarelational","homepage":null,"size":1727,"stargazers_count":27,"watchers_count":27,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":8,"forks":9,"open_issues":8,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/outr/scalarelational/pulls/67"},"html":{"href":"https://github.com/outr/scalarelational/pull/67"},"issue":{"href":"https://api.github.com/repos/outr/scalarelational/issues/67"},"comments":{"href":"https://api.github.com/repos/outr/scalarelational/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/outr/scalarelational/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/outr/scalarelational/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/outr/scalarelational/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/outr/scalarelational/statuses/4e73626c0d960117f1659d869f60593067bada46"}}}}