为模型定义tsvector类型列

时间:2017-10-11 08:42:28

标签: go go-gorm

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

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

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

1 个答案:

答案 0 :(得分:0)

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

同时参考https://github.com/jinzhu/gorm/blob/master/dialects/postgres/postgres.go,它应该与hstore,jsonb

类似