{"action":"created","issue":{"url":"https://api.github.com/repos/groue/GRDB.swift/issues/391","repository_url":"https://api.github.com/repos/groue/GRDB.swift","labels_url":"https://api.github.com/repos/groue/GRDB.swift/issues/391/labels{/name}","comments_url":"https://api.github.com/repos/groue/GRDB.swift/issues/391/comments","events_url":"https://api.github.com/repos/groue/GRDB.swift/issues/391/events","html_url":"https://github.com/groue/GRDB.swift/issues/391","id":342666643,"node_id":"MDU6SXNzdWUzNDI2NjY2NDM=","number":391,"title":"Column identifiers in queries","user":{"login":"kluufger","id":35971588,"node_id":"MDQ6VXNlcjM1OTcxNTg4","avatar_url":"https://avatars0.githubusercontent.com/u/35971588?v=4","gravatar_id":"","url":"https://api.github.com/users/kluufger","html_url":"https://github.com/kluufger","followers_url":"https://api.github.com/users/kluufger/followers","following_url":"https://api.github.com/users/kluufger/following{/other_user}","gists_url":"https://api.github.com/users/kluufger/gists{/gist_id}","starred_url":"https://api.github.com/users/kluufger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kluufger/subscriptions","organizations_url":"https://api.github.com/users/kluufger/orgs","repos_url":"https://api.github.com/users/kluufger/repos","events_url":"https://api.github.com/users/kluufger/events{/privacy}","received_events_url":"https://api.github.com/users/kluufger/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-19T10:15:22Z","updated_at":"2018-07-19T10:19:24Z","closed_at":"2018-07-19T10:19:24Z","author_association":"CONTRIBUTOR","body":"How do `emailColumn` and `nameColumn` in queries like\r\n```swift\r\nlet request = Player.filter(emailColumn != nil).order(nameColumn)\r\n```\r\nwork? Are they supposed to be variables defined somewhere before this line (form the README.md) or are they somehow converted into the respective column names during the query building process? I tried to recreated such a query request in a playground\r\n\r\n```swift\r\ntry dbQueue.read { db in\r\n  try Book.filter(titleColumn == \"asdf\").fetchOne(db)\r\n}\r\n```\r\n\r\nbut xcode complained that `titleColumn` was undifined\r\n\r\n```swift\r\nerror: TryingGRDB.playground:37:19: error: use of unresolved identifier 'titleColumn'\r\n  try Book.filter(titleColumn == \"asdf\").fetchOne(db)\r\n```\r\n\r\n---\r\n\r\nUsing the `enum Columns: String, ColumnExpression` enum values worked, though, but it's not particularly relevant:\r\n\r\n```swift\r\ntry dbQueue.read { db in\r\n  try Book.filter(Book.Columns.title == \"asdf\").fetchOne(db)\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/groue/GRDB.swift/issues/comments/406228666","html_url":"https://github.com/groue/GRDB.swift/issues/391#issuecomment-406228666","issue_url":"https://api.github.com/repos/groue/GRDB.swift/issues/391","id":406228666,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjIyODY2Ng==","user":{"login":"kluufger","id":35971588,"node_id":"MDQ6VXNlcjM1OTcxNTg4","avatar_url":"https://avatars0.githubusercontent.com/u/35971588?v=4","gravatar_id":"","url":"https://api.github.com/users/kluufger","html_url":"https://github.com/kluufger","followers_url":"https://api.github.com/users/kluufger/followers","following_url":"https://api.github.com/users/kluufger/following{/other_user}","gists_url":"https://api.github.com/users/kluufger/gists{/gist_id}","starred_url":"https://api.github.com/users/kluufger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kluufger/subscriptions","organizations_url":"https://api.github.com/users/kluufger/orgs","repos_url":"https://api.github.com/users/kluufger/repos","events_url":"https://api.github.com/users/kluufger/events{/privacy}","received_events_url":"https://api.github.com/users/kluufger/received_events","type":"User","site_admin":false},"created_at":"2018-07-19T10:19:24Z","updated_at":"2018-07-19T10:19:24Z","author_association":"CONTRIBUTOR","body":"Ignore me, this very question is answered a few lines below the example query I posted.\r\n\r\n> Declare the table columns that you want to use for filtering, or sorting:\r\n> ```swift\r\n> let idColumn = Column(\"id\")\r\n> let nameColumn = Column(\"name\")\r\n> ```"}}
{"actor":{"display_login":"kluufger"}}