为模型定义 tsvector 类型列

Define tsvector type column for a model

我想通过在模型结构中定义一个字段来在 postgres 中添加类型为 tsvector 的列。它看起来有点像:

type Issue struct {
  ...
  TSV tsvector `json:"tsv"`
}

原因是我想在开发时使用 gorm 的 AutoMigrate 来保持表格是最新的。有什么想法吗?

type Address struct {
    TSV string         `gorm:"type:tsvector"`
}

另请参考https://github.com/jinzhu/gorm/blob/master/dialects/postgres/postgres.go,它的工作原理应该类似于hstore、jsonb