Lessons Learned: GoLang GORM – filtering associations

The problem Given the following code: type User struct { gorm.Model Username string Orders []Order } type Order struct { gorm.Model UserID uint Foobar string } The above Golang code defines a "Has Many" association, leading to a schema where a "User" "has many" "Orders", with the "user_id" key acting as a foreign key. How … Continue reading Lessons Learned: GoLang GORM – filtering associations

Practical embedding in GoLang

Eric Urban has written a phenomenal blog post about embedding in Golang: http://www.hydrogen18.com/blog/golang-embedding.html Embedding in Golang is an important concept to  grasp, especially when coming from an object-oriented paradigm, since as Eric describes, embedding in Golang is superficially similar to OO's inheritance concept. I came across a practical need for doing this when dealing with … Continue reading Practical embedding in GoLang