{"action":"closed","number":57,"pull_request":{"url":"https://api.github.com/repos/fwbrasil/clump/pulls/57","id":28314636,"html_url":"https://github.com/fwbrasil/clump/pull/57","diff_url":"https://github.com/fwbrasil/clump/pull/57.diff","patch_url":"https://github.com/fwbrasil/clump/pull/57.patch","issue_url":"https://api.github.com/repos/fwbrasil/clump/issues/57","number":57,"state":"closed","locked":false,"title":"permit the usage of non-singleton sources","user":{"login":"fwbrasil","id":831175,"avatar_url":"https://avatars.githubusercontent.com/u/831175?v=3","gravatar_id":"","url":"https://api.github.com/users/fwbrasil","html_url":"https://github.com/fwbrasil","followers_url":"https://api.github.com/users/fwbrasil/followers","following_url":"https://api.github.com/users/fwbrasil/following{/other_user}","gists_url":"https://api.github.com/users/fwbrasil/gists{/gist_id}","starred_url":"https://api.github.com/users/fwbrasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwbrasil/subscriptions","organizations_url":"https://api.github.com/users/fwbrasil/orgs","repos_url":"https://api.github.com/users/fwbrasil/repos","events_url":"https://api.github.com/users/fwbrasil/events{/privacy}","received_events_url":"https://api.github.com/users/fwbrasil/received_events","type":"User","site_admin":false},"body":"@williamboxhall The current limitation that forces the user to guarantee singleton sources makes harder the adoption of Clump. For instance, it is common to have a parameter with the user's authentication information. \r\n\r\nThis pull request removes this limitation and permits the user to use Clump without worrying about the sources being singletons:\r\n\r\n```scala\r\nclass TrackRepository(users: UserRepository) {\r\n\r\n    private def trackSourceFor(session: Session) = Clump.source(tracksService.fetch(session, _))(_.trackId)\r\n\r\n    def trackClump(session: Session, trackId: Long): Clump[Track] =\r\n        for {\r\n            track <- trackSourceFor(session).get(trackId)\r\n            user <- users.userClump(session, track.userId)\r\n        } yield {\r\n            new EnrichedTrack(track, user)\r\n        }\r\n}\r\n```\r\n\r\nThe ```FunctionIdentity``` class is capable to detect if the function has the same parameters from the outer scope (session) and batch the requests. It uses reflection, that isn't great solution, but there isn't an alternative afaik.\r\n\r\nI've been using this approach for my persistence framework[0] queries for a long time without problems.\r\n\r\n[0] http://github.com/fwbrasil/activate/","created_at":"2015-01-29T21:06:18Z","updated_at":"2015-01-30T14:50:35Z","closed_at":"2015-01-30T14:50:35Z","merged_at":"2015-01-30T14:50:35Z","merge_commit_sha":"f1326acfc2c67cb044e53b4a8fccd6069f6bde79","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fwbrasil/clump/pulls/57/commits","review_comments_url":"https://api.github.com/repos/fwbrasil/clump/pulls/57/comments","review_comment_url":"https://api.github.com/repos/fwbrasil/clump/pulls/comments/{number}","comments_url":"https://api.github.com/repos/fwbrasil/clump/issues/57/comments","statuses_url":"https://api.github.com/repos/fwbrasil/clump/statuses/c8a1308b39422a34d420fc8686cd87e8db4d3686","head":{"label":"fwbrasil:non-singleton-sources","ref":"non-singleton-sources","sha":"c8a1308b39422a34d420fc8686cd87e8db4d3686","user":{"login":"fwbrasil","id":831175,"avatar_url":"https://avatars.githubusercontent.com/u/831175?v=3","gravatar_id":"","url":"https://api.github.com/users/fwbrasil","html_url":"https://github.com/fwbrasil","followers_url":"https://api.github.com/users/fwbrasil/followers","following_url":"https://api.github.com/users/fwbrasil/following{/other_user}","gists_url":"https://api.github.com/users/fwbrasil/gists{/gist_id}","starred_url":"https://api.github.com/users/fwbrasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwbrasil/subscriptions","organizations_url":"https://api.github.com/users/fwbrasil/orgs","repos_url":"https://api.github.com/users/fwbrasil/repos","events_url":"https://api.github.com/users/fwbrasil/events{/privacy}","received_events_url":"https://api.github.com/users/fwbrasil/received_events","type":"User","site_admin":false},"repo":{"id":27430086,"name":"clump","full_name":"fwbrasil/clump","owner":{"login":"fwbrasil","id":831175,"avatar_url":"https://avatars.githubusercontent.com/u/831175?v=3","gravatar_id":"","url":"https://api.github.com/users/fwbrasil","html_url":"https://github.com/fwbrasil","followers_url":"https://api.github.com/users/fwbrasil/followers","following_url":"https://api.github.com/users/fwbrasil/following{/other_user}","gists_url":"https://api.github.com/users/fwbrasil/gists{/gist_id}","starred_url":"https://api.github.com/users/fwbrasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwbrasil/subscriptions","organizations_url":"https://api.github.com/users/fwbrasil/orgs","repos_url":"https://api.github.com/users/fwbrasil/repos","events_url":"https://api.github.com/users/fwbrasil/events{/privacy}","received_events_url":"https://api.github.com/users/fwbrasil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fwbrasil/clump","description":"A library for expressive and efficient service composition","fork":true,"url":"https://api.github.com/repos/fwbrasil/clump","forks_url":"https://api.github.com/repos/fwbrasil/clump/forks","keys_url":"https://api.github.com/repos/fwbrasil/clump/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fwbrasil/clump/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fwbrasil/clump/teams","hooks_url":"https://api.github.com/repos/fwbrasil/clump/hooks","issue_events_url":"https://api.github.com/repos/fwbrasil/clump/issues/events{/number}","events_url":"https://api.github.com/repos/fwbrasil/clump/events","assignees_url":"https://api.github.com/repos/fwbrasil/clump/assignees{/user}","branches_url":"https://api.github.com/repos/fwbrasil/clump/branches{/branch}","tags_url":"https://api.github.com/repos/fwbrasil/clump/tags","blobs_url":"https://api.github.com/repos/fwbrasil/clump/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fwbrasil/clump/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fwbrasil/clump/git/refs{/sha}","trees_url":"https://api.github.com/repos/fwbrasil/clump/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fwbrasil/clump/statuses/{sha}","languages_url":"https://api.github.com/repos/fwbrasil/clump/languages","stargazers_url":"https://api.github.com/repos/fwbrasil/clump/stargazers","contributors_url":"https://api.github.com/repos/fwbrasil/clump/contributors","subscribers_url":"https://api.github.com/repos/fwbrasil/clump/subscribers","subscription_url":"https://api.github.com/repos/fwbrasil/clump/subscription","commits_url":"https://api.github.com/repos/fwbrasil/clump/commits{/sha}","git_commits_url":"https://api.github.com/repos/fwbrasil/clump/git/commits{/sha}","comments_url":"https://api.github.com/repos/fwbrasil/clump/comments{/number}","issue_comment_url":"https://api.github.com/repos/fwbrasil/clump/issues/comments/{number}","contents_url":"https://api.github.com/repos/fwbrasil/clump/contents/{+path}","compare_url":"https://api.github.com/repos/fwbrasil/clump/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fwbrasil/clump/merges","archive_url":"https://api.github.com/repos/fwbrasil/clump/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fwbrasil/clump/downloads","issues_url":"https://api.github.com/repos/fwbrasil/clump/issues{/number}","pulls_url":"https://api.github.com/repos/fwbrasil/clump/pulls{/number}","milestones_url":"https://api.github.com/repos/fwbrasil/clump/milestones{/number}","notifications_url":"https://api.github.com/repos/fwbrasil/clump/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fwbrasil/clump/labels{/name}","releases_url":"https://api.github.com/repos/fwbrasil/clump/releases{/id}","created_at":"2014-12-02T11:46:09Z","updated_at":"2015-01-30T14:50:25Z","pushed_at":"2015-01-30T14:50:36Z","git_url":"git://github.com/fwbrasil/clump.git","ssh_url":"git@github.com:fwbrasil/clump.git","clone_url":"https://github.com/fwbrasil/clump.git","svn_url":"https://github.com/fwbrasil/clump","homepage":"","size":1630,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"fwbrasil:master","ref":"master","sha":"d3c6ed35743132aa6a9fe9672ebcf05b69ff4d0e","user":{"login":"fwbrasil","id":831175,"avatar_url":"https://avatars.githubusercontent.com/u/831175?v=3","gravatar_id":"","url":"https://api.github.com/users/fwbrasil","html_url":"https://github.com/fwbrasil","followers_url":"https://api.github.com/users/fwbrasil/followers","following_url":"https://api.github.com/users/fwbrasil/following{/other_user}","gists_url":"https://api.github.com/users/fwbrasil/gists{/gist_id}","starred_url":"https://api.github.com/users/fwbrasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwbrasil/subscriptions","organizations_url":"https://api.github.com/users/fwbrasil/orgs","repos_url":"https://api.github.com/users/fwbrasil/repos","events_url":"https://api.github.com/users/fwbrasil/events{/privacy}","received_events_url":"https://api.github.com/users/fwbrasil/received_events","type":"User","site_admin":false},"repo":{"id":27430086,"name":"clump","full_name":"fwbrasil/clump","owner":{"login":"fwbrasil","id":831175,"avatar_url":"https://avatars.githubusercontent.com/u/831175?v=3","gravatar_id":"","url":"https://api.github.com/users/fwbrasil","html_url":"https://github.com/fwbrasil","followers_url":"https://api.github.com/users/fwbrasil/followers","following_url":"https://api.github.com/users/fwbrasil/following{/other_user}","gists_url":"https://api.github.com/users/fwbrasil/gists{/gist_id}","starred_url":"https://api.github.com/users/fwbrasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwbrasil/subscriptions","organizations_url":"https://api.github.com/users/fwbrasil/orgs","repos_url":"https://api.github.com/users/fwbrasil/repos","events_url":"https://api.github.com/users/fwbrasil/events{/privacy}","received_events_url":"https://api.github.com/users/fwbrasil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fwbrasil/clump","description":"A library for expressive and efficient service composition","fork":true,"url":"https://api.github.com/repos/fwbrasil/clump","forks_url":"https://api.github.com/repos/fwbrasil/clump/forks","keys_url":"https://api.github.com/repos/fwbrasil/clump/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fwbrasil/clump/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fwbrasil/clump/teams","hooks_url":"https://api.github.com/repos/fwbrasil/clump/hooks","issue_events_url":"https://api.github.com/repos/fwbrasil/clump/issues/events{/number}","events_url":"https://api.github.com/repos/fwbrasil/clump/events","assignees_url":"https://api.github.com/repos/fwbrasil/clump/assignees{/user}","branches_url":"https://api.github.com/repos/fwbrasil/clump/branches{/branch}","tags_url":"https://api.github.com/repos/fwbrasil/clump/tags","blobs_url":"https://api.github.com/repos/fwbrasil/clump/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fwbrasil/clump/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fwbrasil/clump/git/refs{/sha}","trees_url":"https://api.github.com/repos/fwbrasil/clump/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fwbrasil/clump/statuses/{sha}","languages_url":"https://api.github.com/repos/fwbrasil/clump/languages","stargazers_url":"https://api.github.com/repos/fwbrasil/clump/stargazers","contributors_url":"https://api.github.com/repos/fwbrasil/clump/contributors","subscribers_url":"https://api.github.com/repos/fwbrasil/clump/subscribers","subscription_url":"https://api.github.com/repos/fwbrasil/clump/subscription","commits_url":"https://api.github.com/repos/fwbrasil/clump/commits{/sha}","git_commits_url":"https://api.github.com/repos/fwbrasil/clump/git/commits{/sha}","comments_url":"https://api.github.com/repos/fwbrasil/clump/comments{/number}","issue_comment_url":"https://api.github.com/repos/fwbrasil/clump/issues/comments/{number}","contents_url":"https://api.github.com/repos/fwbrasil/clump/contents/{+path}","compare_url":"https://api.github.com/repos/fwbrasil/clump/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fwbrasil/clump/merges","archive_url":"https://api.github.com/repos/fwbrasil/clump/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fwbrasil/clump/downloads","issues_url":"https://api.github.com/repos/fwbrasil/clump/issues{/number}","pulls_url":"https://api.github.com/repos/fwbrasil/clump/pulls{/number}","milestones_url":"https://api.github.com/repos/fwbrasil/clump/milestones{/number}","notifications_url":"https://api.github.com/repos/fwbrasil/clump/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fwbrasil/clump/labels{/name}","releases_url":"https://api.github.com/repos/fwbrasil/clump/releases{/id}","created_at":"2014-12-02T11:46:09Z","updated_at":"2015-01-30T14:50:25Z","pushed_at":"2015-01-30T14:50:36Z","git_url":"git://github.com/fwbrasil/clump.git","ssh_url":"git@github.com:fwbrasil/clump.git","clone_url":"https://github.com/fwbrasil/clump.git","svn_url":"https://github.com/fwbrasil/clump","homepage":"","size":1630,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fwbrasil/clump/pulls/57"},"html":{"href":"https://github.com/fwbrasil/clump/pull/57"},"issue":{"href":"https://api.github.com/repos/fwbrasil/clump/issues/57"},"comments":{"href":"https://api.github.com/repos/fwbrasil/clump/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/fwbrasil/clump/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/fwbrasil/clump/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/fwbrasil/clump/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/fwbrasil/clump/statuses/c8a1308b39422a34d420fc8686cd87e8db4d3686"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"fwbrasil","id":831175,"avatar_url":"https://avatars.githubusercontent.com/u/831175?v=3","gravatar_id":"","url":"https://api.github.com/users/fwbrasil","html_url":"https://github.com/fwbrasil","followers_url":"https://api.github.com/users/fwbrasil/followers","following_url":"https://api.github.com/users/fwbrasil/following{/other_user}","gists_url":"https://api.github.com/users/fwbrasil/gists{/gist_id}","starred_url":"https://api.github.com/users/fwbrasil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fwbrasil/subscriptions","organizations_url":"https://api.github.com/users/fwbrasil/orgs","repos_url":"https://api.github.com/users/fwbrasil/repos","events_url":"https://api.github.com/users/fwbrasil/events{/privacy}","received_events_url":"https://api.github.com/users/fwbrasil/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":1,"additions":130,"deletions":30,"changed_files":7}}