{"action":"created","issue":{"url":"https://api.github.com/repos/andrewoma/kwery/issues/4","repository_url":"https://api.github.com/repos/andrewoma/kwery","labels_url":"https://api.github.com/repos/andrewoma/kwery/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/andrewoma/kwery/issues/4/comments","events_url":"https://api.github.com/repos/andrewoma/kwery/issues/4/events","html_url":"https://github.com/andrewoma/kwery/issues/4","id":154845256,"number":4,"title":"Pagination with offset, limit queries?","user":{"login":"davemaple","id":3209030,"avatar_url":"https://avatars.githubusercontent.com/u/3209030?v=3","gravatar_id":"","url":"https://api.github.com/users/davemaple","html_url":"https://github.com/davemaple","followers_url":"https://api.github.com/users/davemaple/followers","following_url":"https://api.github.com/users/davemaple/following{/other_user}","gists_url":"https://api.github.com/users/davemaple/gists{/gist_id}","starred_url":"https://api.github.com/users/davemaple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davemaple/subscriptions","organizations_url":"https://api.github.com/users/davemaple/orgs","repos_url":"https://api.github.com/users/davemaple/repos","events_url":"https://api.github.com/users/davemaple/events{/privacy}","received_events_url":"https://api.github.com/users/davemaple/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-14T10:04:04Z","updated_at":"2016-05-16T21:19:34Z","closed_at":null,"body":"Hi Andrew,\r\n\r\nDo you ever use pagination in your queries using offset, limit? I try to avoid large offsets but I continue to find examples where it's helpful. Currently I'm implementing it within a DAO with something like this:\r\n\r\n```kotlin\r\nval name = \"findPaginated\"\r\nval sql = sql(name) {\r\n\t\"\"\"\r\n\t\tSELECT\r\n\t\t\t$columns\r\n\t\tFROM\r\n\t\t\t${table.name}\r\n\t\tLIMIT :offset, :limit\r\n\t\"\"\"\r\n}\r\nreturn session.select(\r\n\t\tsql,\r\n\t\tmapOf(\"offset\" to offset, \"limit\" to limit),\r\n\t\toptions(name),\r\n\t\ttable.rowMapper()\r\n);\r\n```\r\n\r\nI'm wondering if this would be something worthy of adding to AbstractDao. Your thoughts?"},"comment":{"url":"https://api.github.com/repos/andrewoma/kwery/issues/comments/219551358","html_url":"https://github.com/andrewoma/kwery/issues/4#issuecomment-219551358","issue_url":"https://api.github.com/repos/andrewoma/kwery/issues/4","id":219551358,"user":{"login":"andrewoma","id":156917,"avatar_url":"https://avatars.githubusercontent.com/u/156917?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewoma","html_url":"https://github.com/andrewoma","followers_url":"https://api.github.com/users/andrewoma/followers","following_url":"https://api.github.com/users/andrewoma/following{/other_user}","gists_url":"https://api.github.com/users/andrewoma/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewoma/subscriptions","organizations_url":"https://api.github.com/users/andrewoma/orgs","repos_url":"https://api.github.com/users/andrewoma/repos","events_url":"https://api.github.com/users/andrewoma/events{/privacy}","received_events_url":"https://api.github.com/users/andrewoma/received_events","type":"User","site_admin":false},"created_at":"2016-05-16T21:19:33Z","updated_at":"2016-05-16T21:19:33Z","body":"Hi Dave,\r\n\r\nI decided to implement limit and offset in the core via `StatementOptions`. \r\n\r\nSee https://github.com/andrewoma/kwery/commit/d8770629290a1553a58a8c57e7bdf02fa47fde44\r\n\r\nI think it should cover your use case as well as the general case.\r\n\r\nCheers,\r\nAndrew"}}