When you need to handle text tags in Golang, eg. a Document
can be tagged with software engineering
, important
and golang
,
you could do it with the Postgres text[]
array type.
But with the jsonb
type, you have all the marshalling and unmarshalling already there, so all you need to do is have a []string
type,
like below:
type JSONTags []string
func (tags *JSONTags) Scan(src interface{}) error {