{"action":"created","issue":{"url":"https://api.github.com/repos/tpolecat/doobie/issues/375","repository_url":"https://api.github.com/repos/tpolecat/doobie","labels_url":"https://api.github.com/repos/tpolecat/doobie/issues/375/labels{/name}","comments_url":"https://api.github.com/repos/tpolecat/doobie/issues/375/comments","events_url":"https://api.github.com/repos/tpolecat/doobie/issues/375/events","html_url":"https://github.com/tpolecat/doobie/issues/375","id":186069516,"number":375,"title":"Safer, more typed queries - with table description ?","user":{"login":"fanf","id":44649,"avatar_url":"https://avatars.githubusercontent.com/u/44649?v=3","gravatar_id":"","url":"https://api.github.com/users/fanf","html_url":"https://github.com/fanf","followers_url":"https://api.github.com/users/fanf/followers","following_url":"https://api.github.com/users/fanf/following{/other_user}","gists_url":"https://api.github.com/users/fanf/gists{/gist_id}","starred_url":"https://api.github.com/users/fanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanf/subscriptions","organizations_url":"https://api.github.com/users/fanf/orgs","repos_url":"https://api.github.com/users/fanf/repos","events_url":"https://api.github.com/users/fanf/events{/privacy}","received_events_url":"https://api.github.com/users/fanf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-10-29T09:38:49Z","updated_at":"2016-11-02T08:21:49Z","closed_at":null,"body":"I'm opening the ticket to track ideas and advancement about how to make queries more typesafe. \n\nThe general feedback on Doobie is \"it's awesome, but I would love to get some sureness about the type of columns or argument I'm giving\". \n\nWe don't exactly know what could be done. \n\nThe first level of ideas is to have a way to check at compile time that the number of row returned matches the number of types given in .query, so that simple refactoring / changes in the column is checked. \n\nThe second level of ideas is to be able to add some type annotation on columns  in the select / update to be able to check both the number of returned columns and the correctness of the types, something like:\n\n```\nsql\"select id${t[Long]}, name${t[String]} from .users ...\".query.list\n```\n\nThe third level of ideas is to have some (simple) way to describe tables in Scala and use that in query. Contrary to Slick, the description can be simple, because we are only interest on the name of the colum and the table, the idea is only to somehow centralise these name and the mapping between the name and it's type to get more sureness at compile time: \n\n```\nobject users extends Table(\"users\") { \n  object id extends Column[Long](\"id\") \n  object name extends Column[String] // or even without param if the val name is the same \n  val all = columns[users] //something like ca.mrvisser.sealerate.values[]\n}\n\nimport users.{id, name}\nsql\"\"\"select $id, $name from $users where ...\".query.list\n```\n\nOr (idea 4) with a full blown DSL: \n\n```\nselect (users.id, users.name) from (users) where ..\n```\n\nAll these ideas are simple ideas taken from people, some not even using Doobie. I don't know what is possible (my personnal wish is that something like level 3 is possible).\n"},"comment":{"url":"https://api.github.com/repos/tpolecat/doobie/issues/comments/257800080","html_url":"https://github.com/tpolecat/doobie/issues/375#issuecomment-257800080","issue_url":"https://api.github.com/repos/tpolecat/doobie/issues/375","id":257800080,"user":{"login":"fanf","id":44649,"avatar_url":"https://avatars.githubusercontent.com/u/44649?v=3","gravatar_id":"","url":"https://api.github.com/users/fanf","html_url":"https://github.com/fanf","followers_url":"https://api.github.com/users/fanf/followers","following_url":"https://api.github.com/users/fanf/following{/other_user}","gists_url":"https://api.github.com/users/fanf/gists{/gist_id}","starred_url":"https://api.github.com/users/fanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanf/subscriptions","organizations_url":"https://api.github.com/users/fanf/orgs","repos_url":"https://api.github.com/users/fanf/repos","events_url":"https://api.github.com/users/fanf/events{/privacy}","received_events_url":"https://api.github.com/users/fanf/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T08:21:49Z","updated_at":"2016-11-02T08:21:49Z","body":"The cache (committed in source control) would be perfect.\n\nAnd of course the schema is in source control, but I want to make\npotentially interest people the simplest possible built experience. An\nopt-in solution, where people dealing with DB stuff and our\nCI-with-long-tests can have fully validated queries but where other groups\ndon't even know that the thing exists would be the best of both world.\n\nOh, and I'm pretty sure there is examples where you just want to\ndemo/compile some stuff on a clean machine (even a windows/Mac one!)\nwithout db or even network access, and need a way to do it successfully :).\nI know, horror stories ;)\n\nLe 1 nov. 2016 7:37 PM, \"Marek Kadek\" <notifications@github.com> a écrit :\n>\n> Yep I dont see it as a big deal. I would most likely push for this in our\n> infrastructure...benefits are too big : )\n>\n> On Wed, Nov 2, 2016, 06:59 Rob Norris <notifications@github.com> wrote:\n>\n> > But I should note that your schema and migrations should be committed as\n> > source as well, and setting up Postgres on Travis at least is trivial.\n> >\n> > Migrations just need to run before compilation, which is easy to\narrange.\n> >\n> > —\n> > You are receiving this because you commented.\n> > Reply to this email directly, view it on GitHub\n> > <https://github.com/tpolecat/doobie/issues/375#issuecomment-257642023>,\n> > or mute the thread\n> > <\nhttps://github.com/notifications/unsubscribe-auth/AEG1Z_RPvbFVx_ySWVgSj1W3V4sHhcQLks5q534WgaJpZM4KkEkH\n>\n> > .\n> >\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub, or mute the thread.\n"}}
{"actor":{"display_login":"fanf"}}