development

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” […]

Read more
development

Mac OS X: role “postgres” does not exist

Install Postgres brew install Postgres Try to log in. $ psql -h localhost -d postgres -U postgres psql: error: could not connect to server: FATAL: role “postgres” does not exist Create the user $ /usr/local/opt/postgres/bin/createuser -s postgres Start the server $ pg_ctl -D /usr/local/var/postgres start pg_ctl: another server might be running; trying to start server […]

Read more