{"action":"created","issue":{"url":"https://api.github.com/repos/volatiletech/sqlboiler/issues/343","repository_url":"https://api.github.com/repos/volatiletech/sqlboiler","labels_url":"https://api.github.com/repos/volatiletech/sqlboiler/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/volatiletech/sqlboiler/issues/343/comments","events_url":"https://api.github.com/repos/volatiletech/sqlboiler/issues/343/events","html_url":"https://github.com/volatiletech/sqlboiler/issues/343","id":341348698,"node_id":"MDU6SXNzdWUzNDEzNDg2OTg=","number":343,"title":"foreign key column names different from x_id","user":{"login":"saulortega","id":6834676,"node_id":"MDQ6VXNlcjY4MzQ2NzY=","avatar_url":"https://avatars1.githubusercontent.com/u/6834676?v=4","gravatar_id":"","url":"https://api.github.com/users/saulortega","html_url":"https://github.com/saulortega","followers_url":"https://api.github.com/users/saulortega/followers","following_url":"https://api.github.com/users/saulortega/following{/other_user}","gists_url":"https://api.github.com/users/saulortega/gists{/gist_id}","starred_url":"https://api.github.com/users/saulortega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saulortega/subscriptions","organizations_url":"https://api.github.com/users/saulortega/orgs","repos_url":"https://api.github.com/users/saulortega/repos","events_url":"https://api.github.com/users/saulortega/events{/privacy}","received_events_url":"https://api.github.com/users/saulortega/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-15T20:10:44Z","updated_at":"2018-07-15T21:41:06Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"If my foreign key column is named `foo_id`, SQLBoiler generates `func (o *Bar) Foo(mods ...qm.QueryMod) fooQuery`.\r\n\r\nBut, if the foreign key column is named in any other way different from x_id, the Method and the Struct Field will be both named the same. That's not possible in Go, so it will throw an error.\r\n\r\nIn that case, I suggets to use the UpSigngular name of the foreign table."},"comment":{"url":"https://api.github.com/repos/volatiletech/sqlboiler/issues/comments/405120491","html_url":"https://github.com/volatiletech/sqlboiler/issues/343#issuecomment-405120491","issue_url":"https://api.github.com/repos/volatiletech/sqlboiler/issues/343","id":405120491,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTEyMDQ5MQ==","user":{"login":"saulortega","id":6834676,"node_id":"MDQ6VXNlcjY4MzQ2NzY=","avatar_url":"https://avatars1.githubusercontent.com/u/6834676?v=4","gravatar_id":"","url":"https://api.github.com/users/saulortega","html_url":"https://github.com/saulortega","followers_url":"https://api.github.com/users/saulortega/followers","following_url":"https://api.github.com/users/saulortega/following{/other_user}","gists_url":"https://api.github.com/users/saulortega/gists{/gist_id}","starred_url":"https://api.github.com/users/saulortega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saulortega/subscriptions","organizations_url":"https://api.github.com/users/saulortega/orgs","repos_url":"https://api.github.com/users/saulortega/repos","events_url":"https://api.github.com/users/saulortega/events{/privacy}","received_events_url":"https://api.github.com/users/saulortega/received_events","type":"User","site_admin":false},"created_at":"2018-07-15T21:41:06Z","updated_at":"2018-07-15T21:41:06Z","author_association":"CONTRIBUTOR","body":"```go\r\n// Tpru1Sub is an object representing the database table.\r\ntype Tpru1Sub struct {\r\n\tLlave     string `boil:\"llave\" json:\"llave\" toml:\"llave\" yaml:\"llave\"`\r\n\tFkeyTpru1 string `boil:\"fkey_tpru1\" json:\"fkey_tpru1\" toml:\"fkey_tpru1\" yaml:\"fkey_tpru1\"`\r\n\tFoo       string `boil:\"foo\" json:\"foo\" toml:\"foo\" yaml:\"foo\"`\r\n\r\n\tR *tpru1SubR `boil:\"-\" json:\"-\" toml:\"-\" yaml:\"-\"`\r\n\tL tpru1SubL  `boil:\"-\" json:\"-\" toml:\"-\" yaml:\"-\"`\r\n}\r\n\r\n// FkeyTpru1 pointed to by the foreign key.\r\nfunc (o *Tpru1Sub) FkeyTpru1(mods ...qm.QueryMod) tpru1Query {\r\n\tqueryMods := []qm.QueryMod{\r\n\t\tqm.Where(\"llave=?\", o.FkeyTpru1),\r\n\t}\r\n\r\n\tqueryMods = append(queryMods, mods...)\r\n\r\n\tquery := Tpru1s(queryMods...)\r\n\tqueries.SetFrom(query.Query, \"\\\"tpru1\\\"\")\r\n\r\n\treturn query\r\n}\r\n```\r\n\r\n```go\r\nTpru1Sub.FkeyTpru1 // Field\r\nTpru1Sub.FkeyTpru1() // Method\r\n```\r\n\r\nFields and Methods can't be named the same.\r\n\r\nWith aliases I can change the Field, not the Method. For my case of use the more natural is to rename the Method, not the Field."}}
{"actor":{"display_login":"saulortega"}}