{"action":"created","issue":{"url":"https://api.github.com/repos/astaxie/beego/issues/2515","repository_url":"https://api.github.com/repos/astaxie/beego","labels_url":"https://api.github.com/repos/astaxie/beego/issues/2515/labels{/name}","comments_url":"https://api.github.com/repos/astaxie/beego/issues/2515/comments","events_url":"https://api.github.com/repos/astaxie/beego/issues/2515/events","html_url":"https://github.com/astaxie/beego/issues/2515","id":215164196,"number":2515,"title":"NewOrmWithDB cause panic: time: missing Location in call to Time.In","user":{"login":"tedli","id":3324663,"avatar_url":"https://avatars2.githubusercontent.com/u/3324663?v=4","gravatar_id":"","url":"https://api.github.com/users/tedli","html_url":"https://github.com/tedli","followers_url":"https://api.github.com/users/tedli/followers","following_url":"https://api.github.com/users/tedli/following{/other_user}","gists_url":"https://api.github.com/users/tedli/gists{/gist_id}","starred_url":"https://api.github.com/users/tedli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tedli/subscriptions","organizations_url":"https://api.github.com/users/tedli/orgs","repos_url":"https://api.github.com/users/tedli/repos","events_url":"https://api.github.com/users/tedli/events{/privacy}","received_events_url":"https://api.github.com/users/tedli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-03-18T03:52:13Z","updated_at":"2018-04-26T02:53:35Z","closed_at":null,"author_association":"NONE","body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n1. What version of Go and beego are you using (`bee version`)?\r\nbee v1.6.2\r\nBeego 1.7.2\r\nGoVersion go1.8\r\n\r\n2. What operating system and processor architecture are you using (`go env`)?\r\nGOARCH=\"amd64\"\r\nGOOS=\"darwin\"\r\n\r\n3. What did you do?\r\nIf possible, provide a recipe for reproducing the error.\r\nA complete runnable program is good.\r\n```golang\r\no, err = orm.NewOrmWithDB(\"postgres\", \"default\", GetSqlDB())\r\ncount, err = o.QueryTable(new(LynisReport)).Filter(constraint, value).OrderBy(\"-scanned_at\").All(&result);\r\n```\r\n\r\n4. What did you expect to see?\r\nno panic like this `panic: time: missing Location in call to Time.In`\r\n\r\n5. What did you see instead?\r\nin `func NewOrmWithDB(driverName, aliasName string, db *sql.DB) (Ormer, error)` I added two lines.\r\n```golang\r\nal.Name = aliasName\r\nal.DriverName = driverName\r\nal.DB = db  // here\r\n\r\ndetectTZ(al)  // and here\r\n\r\no := new(orm)\r\no.alias = al\r\n```\r\nthen no panic\r\n"},"comment":{"url":"https://api.github.com/repos/astaxie/beego/issues/comments/384496842","html_url":"https://github.com/astaxie/beego/issues/2515#issuecomment-384496842","issue_url":"https://api.github.com/repos/astaxie/beego/issues/2515","id":384496842,"user":{"login":"tedli","id":3324663,"avatar_url":"https://avatars2.githubusercontent.com/u/3324663?v=4","gravatar_id":"","url":"https://api.github.com/users/tedli","html_url":"https://github.com/tedli","followers_url":"https://api.github.com/users/tedli/followers","following_url":"https://api.github.com/users/tedli/following{/other_user}","gists_url":"https://api.github.com/users/tedli/gists{/gist_id}","starred_url":"https://api.github.com/users/tedli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tedli/subscriptions","organizations_url":"https://api.github.com/users/tedli/orgs","repos_url":"https://api.github.com/users/tedli/repos","events_url":"https://api.github.com/users/tedli/events{/privacy}","received_events_url":"https://api.github.com/users/tedli/received_events","type":"User","site_admin":false},"created_at":"2018-04-26T02:53:35Z","updated_at":"2018-04-26T02:53:35Z","author_association":"NONE","body":"@MahaoAlex The database aliases are indeed unique. The code I've posted is just pseudocode.\r\n\r\n\r\nIn my case, I have to use both mysql and postgres for some reason. The mysql is the `default` that is straightforward just like the beego orm tutorial, then I need to alias the postgres one, the `orm.AddAliasWthDB(DatabaseAlias, \"postgres\", db)` actually was `orm.AddAliasWthDB(\"someExpressiveName\", \"postgres\", db)`，I use `DatabaseAlias` to indicate that it can be any string and it's better to define a constant then `o.Using(\"someExpressiveName\")` can use that constant."}}
{"actor":{"display_login":"tedli"}}