ツイート ブックマーク 最近Golangを積極的に使っている僕ですが、Golangでwebアプリをいくつか作り始めました。 ORMはgormを使っているのですが、Belongs Toでハマりました。 ドキュメント通りを参考にBelongs toの設定をしてみました。 http://jinzhu.me/gorm/associations.html#belongs-to type Article struct { ID uint Title string Descriptions string Author Author AuthorID int64 `gorm:"column:hoge_author_id"` } type Author struct { ID uint Username string DisplayName string Image string Description s
![gormでbelongs to にハマった話](https://cdn-ak-scissors.b.st-hatena.com/image/square/d77aa51a1701968cb30b0631785ec7a5b8389426/height=288;version=1;width=512/https%3A%2F%2Fpolidog.jp%2Fimages%2Fcovers%2Fgo-logo.png)