Tag: gorm

Go, gorm, nested JSON and associations

Go, gorm, nested JSON and associations gorm provides a clean way to store a nested JSON with the relation of associations among tables. The following code creates a DB with three levels of nesting. package main import ( “encoding/json” “fmt” “github.com/jinzhu/gorm” _ “github.com/lib/pq” ) const ( host = “localhost” port = 5432 user = “postgres”…