Golang Gorm JSONB Value & Copy Examples
June 18, 2015
Out of the box Gorm doesn’t include support for the JSONB field type implemented in PostgreSQL 9.4. However, you can pretty painlessly define your own struct type, and write Value() and Copy() functions for this type. Below is an example.
JSONB type Definition
Value() & Copy() examples:
Now, when interacting with JSONB Fields via Gorm, the values are automatically marshalled and unmarshalled.