{"action":"created","comment":{"url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/comments/47329656","id":47329656,"diff_hunk":"@@ -3,21 +3,29 @@ package com.softwaremill.events\n import java.time.OffsetDateTime\n \n import com.typesafe.scalalogging.StrictLogging\n-import slick.dbio.Effect.Write\n+import slick.dbio.Effect.{Read, Write}\n import slick.dbio.{DBIOAction, NoStream}\n+import slick.profile.FixedSqlStreamingAction\n \n import scala.concurrent.ExecutionContext\n \n trait EventStore {\n   def store(event: StoredEvent): DBIOAction[Unit, NoStream, Write]\n+  def getAll(timeLimit: OffsetDateTime): FixedSqlStreamingAction[Seq[StoredEvent], StoredEvent, Read]\n+  def getLength(eventTypes: Set[String]): DBIOAction[Int, slick.dbio.NoStream, Nothing]\n }\n \n class DefaultEventStore(protected val database: EventsDatabase)(implicit ec: ExecutionContext)\n     extends EventStore with SqlEventStoreSchema with StrictLogging {\n \n+  import database._\n   import database.driver.api._\n \n   def store(event: StoredEvent) = (events += event).map(_ => ())\n+\n+  def getAll(timeLimit: OffsetDateTime): FixedSqlStreamingAction[Seq[StoredEvent], StoredEvent, Read] = events.filter(_.created < timeLimit).result\n+\n+  def getLength(eventTypes: Set[String]) = events.map(_.eventType).filter(_.inSetBind(eventTypes)).length.result","path":"core/src/main/scala/com/softwaremill/events/EventStore.scala","position":27,"original_position":27,"commit_id":"ee75fcd48048b128f1b4107b9d7c07b23b0e62b2","original_commit_id":"ee75fcd48048b128f1b4107b9d7c07b23b0e62b2","user":{"login":"hanskoff","id":1131827,"avatar_url":"https://avatars.githubusercontent.com/u/1131827?v=3","gravatar_id":"","url":"https://api.github.com/users/hanskoff","html_url":"https://github.com/hanskoff","followers_url":"https://api.github.com/users/hanskoff/followers","following_url":"https://api.github.com/users/hanskoff/following{/other_user}","gists_url":"https://api.github.com/users/hanskoff/gists{/gist_id}","starred_url":"https://api.github.com/users/hanskoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanskoff/subscriptions","organizations_url":"https://api.github.com/users/hanskoff/orgs","repos_url":"https://api.github.com/users/hanskoff/repos","events_url":"https://api.github.com/users/hanskoff/events{/privacy}","received_events_url":"https://api.github.com/users/hanskoff/received_events","type":"User","site_admin":false},"body":"isn't enough when return types are in trait?","created_at":"2015-12-11T08:02:00Z","updated_at":"2015-12-11T08:02:00Z","html_url":"https://github.com/softwaremill/slick-eventsourcing/pull/3#discussion_r47329656","pull_request_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/comments/47329656"},"html":{"href":"https://github.com/softwaremill/slick-eventsourcing/pull/3#discussion_r47329656"},"pull_request":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3","id":52663237,"html_url":"https://github.com/softwaremill/slick-eventsourcing/pull/3","diff_url":"https://github.com/softwaremill/slick-eventsourcing/pull/3.diff","patch_url":"https://github.com/softwaremill/slick-eventsourcing/pull/3.patch","issue_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/3","number":3,"state":"open","locked":false,"title":"introducing recovery logic","user":{"login":"hanskoff","id":1131827,"avatar_url":"https://avatars.githubusercontent.com/u/1131827?v=3","gravatar_id":"","url":"https://api.github.com/users/hanskoff","html_url":"https://github.com/hanskoff","followers_url":"https://api.github.com/users/hanskoff/followers","following_url":"https://api.github.com/users/hanskoff/following{/other_user}","gists_url":"https://api.github.com/users/hanskoff/gists{/gist_id}","starred_url":"https://api.github.com/users/hanskoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanskoff/subscriptions","organizations_url":"https://api.github.com/users/hanskoff/orgs","repos_url":"https://api.github.com/users/hanskoff/repos","events_url":"https://api.github.com/users/hanskoff/events{/privacy}","received_events_url":"https://api.github.com/users/hanskoff/received_events","type":"User","site_admin":false},"body":"The idea is to provide a failover operation from event log to recreate database state","created_at":"2015-12-04T12:25:13Z","updated_at":"2015-12-11T08:02:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8ce31323ef2531808b6b23ed784d1003d6de121","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3/commits","review_comments_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3/comments","review_comment_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/3/comments","statuses_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/statuses/ee75fcd48048b128f1b4107b9d7c07b23b0e62b2","head":{"label":"softwaremill:recovery","ref":"recovery","sha":"ee75fcd48048b128f1b4107b9d7c07b23b0e62b2","user":{"login":"softwaremill","id":322765,"avatar_url":"https://avatars.githubusercontent.com/u/322765?v=3","gravatar_id":"","url":"https://api.github.com/users/softwaremill","html_url":"https://github.com/softwaremill","followers_url":"https://api.github.com/users/softwaremill/followers","following_url":"https://api.github.com/users/softwaremill/following{/other_user}","gists_url":"https://api.github.com/users/softwaremill/gists{/gist_id}","starred_url":"https://api.github.com/users/softwaremill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwaremill/subscriptions","organizations_url":"https://api.github.com/users/softwaremill/orgs","repos_url":"https://api.github.com/users/softwaremill/repos","events_url":"https://api.github.com/users/softwaremill/events{/privacy}","received_events_url":"https://api.github.com/users/softwaremill/received_events","type":"Organization","site_admin":false},"repo":{"id":42510240,"name":"slick-eventsourcing","full_name":"softwaremill/slick-eventsourcing","owner":{"login":"softwaremill","id":322765,"avatar_url":"https://avatars.githubusercontent.com/u/322765?v=3","gravatar_id":"","url":"https://api.github.com/users/softwaremill","html_url":"https://github.com/softwaremill","followers_url":"https://api.github.com/users/softwaremill/followers","following_url":"https://api.github.com/users/softwaremill/following{/other_user}","gists_url":"https://api.github.com/users/softwaremill/gists{/gist_id}","starred_url":"https://api.github.com/users/softwaremill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwaremill/subscriptions","organizations_url":"https://api.github.com/users/softwaremill/orgs","repos_url":"https://api.github.com/users/softwaremill/repos","events_url":"https://api.github.com/users/softwaremill/events{/privacy}","received_events_url":"https://api.github.com/users/softwaremill/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/softwaremill/slick-eventsourcing","description":"Example for \"Entry level event-sourcing\" blog","fork":false,"url":"https://api.github.com/repos/softwaremill/slick-eventsourcing","forks_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/forks","keys_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/teams","hooks_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/hooks","issue_events_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/events{/number}","events_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/events","assignees_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/assignees{/user}","branches_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/branches{/branch}","tags_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/tags","blobs_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/refs{/sha}","trees_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/statuses/{sha}","languages_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/languages","stargazers_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/stargazers","contributors_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/contributors","subscribers_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/subscribers","subscription_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/subscription","commits_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/commits{/sha}","git_commits_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/commits{/sha}","comments_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/comments{/number}","issue_comment_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/comments{/number}","contents_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/contents/{+path}","compare_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/merges","archive_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/downloads","issues_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues{/number}","pulls_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls{/number}","milestones_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/milestones{/number}","notifications_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/labels{/name}","releases_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/releases{/id}","created_at":"2015-09-15T10:05:15Z","updated_at":"2015-12-09T05:47:31Z","pushed_at":"2015-12-09T13:53:32Z","git_url":"git://github.com/softwaremill/slick-eventsourcing.git","ssh_url":"git@github.com:softwaremill/slick-eventsourcing.git","clone_url":"https://github.com/softwaremill/slick-eventsourcing.git","svn_url":"https://github.com/softwaremill/slick-eventsourcing","homepage":"http://softwaremill.com","size":98,"stargazers_count":25,"watchers_count":25,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":25,"default_branch":"master"}},"base":{"label":"softwaremill:master","ref":"master","sha":"b40bf314fe778f2fc040ca05d60f0913cd7dc735","user":{"login":"softwaremill","id":322765,"avatar_url":"https://avatars.githubusercontent.com/u/322765?v=3","gravatar_id":"","url":"https://api.github.com/users/softwaremill","html_url":"https://github.com/softwaremill","followers_url":"https://api.github.com/users/softwaremill/followers","following_url":"https://api.github.com/users/softwaremill/following{/other_user}","gists_url":"https://api.github.com/users/softwaremill/gists{/gist_id}","starred_url":"https://api.github.com/users/softwaremill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwaremill/subscriptions","organizations_url":"https://api.github.com/users/softwaremill/orgs","repos_url":"https://api.github.com/users/softwaremill/repos","events_url":"https://api.github.com/users/softwaremill/events{/privacy}","received_events_url":"https://api.github.com/users/softwaremill/received_events","type":"Organization","site_admin":false},"repo":{"id":42510240,"name":"slick-eventsourcing","full_name":"softwaremill/slick-eventsourcing","owner":{"login":"softwaremill","id":322765,"avatar_url":"https://avatars.githubusercontent.com/u/322765?v=3","gravatar_id":"","url":"https://api.github.com/users/softwaremill","html_url":"https://github.com/softwaremill","followers_url":"https://api.github.com/users/softwaremill/followers","following_url":"https://api.github.com/users/softwaremill/following{/other_user}","gists_url":"https://api.github.com/users/softwaremill/gists{/gist_id}","starred_url":"https://api.github.com/users/softwaremill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softwaremill/subscriptions","organizations_url":"https://api.github.com/users/softwaremill/orgs","repos_url":"https://api.github.com/users/softwaremill/repos","events_url":"https://api.github.com/users/softwaremill/events{/privacy}","received_events_url":"https://api.github.com/users/softwaremill/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/softwaremill/slick-eventsourcing","description":"Example for \"Entry level event-sourcing\" blog","fork":false,"url":"https://api.github.com/repos/softwaremill/slick-eventsourcing","forks_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/forks","keys_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/teams","hooks_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/hooks","issue_events_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/events{/number}","events_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/events","assignees_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/assignees{/user}","branches_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/branches{/branch}","tags_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/tags","blobs_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/refs{/sha}","trees_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/statuses/{sha}","languages_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/languages","stargazers_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/stargazers","contributors_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/contributors","subscribers_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/subscribers","subscription_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/subscription","commits_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/commits{/sha}","git_commits_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/git/commits{/sha}","comments_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/comments{/number}","issue_comment_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/comments{/number}","contents_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/contents/{+path}","compare_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/merges","archive_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/downloads","issues_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues{/number}","pulls_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls{/number}","milestones_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/milestones{/number}","notifications_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/labels{/name}","releases_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/releases{/id}","created_at":"2015-09-15T10:05:15Z","updated_at":"2015-12-09T05:47:31Z","pushed_at":"2015-12-09T13:53:32Z","git_url":"git://github.com/softwaremill/slick-eventsourcing.git","ssh_url":"git@github.com:softwaremill/slick-eventsourcing.git","clone_url":"https://github.com/softwaremill/slick-eventsourcing.git","svn_url":"https://github.com/softwaremill/slick-eventsourcing","homepage":"http://softwaremill.com","size":98,"stargazers_count":25,"watchers_count":25,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3"},"html":{"href":"https://github.com/softwaremill/slick-eventsourcing/pull/3"},"issue":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/3"},"comments":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/softwaremill/slick-eventsourcing/statuses/ee75fcd48048b128f1b4107b9d7c07b23b0e62b2"}}}}