【发布时间】:2016-09-07 00:30:21
【问题描述】:
有一张表customer_account(postgres)是从YII2迁移过来的。
DDL:
CREATE TABLE public.test_table (
id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('test_table_id_seq'::regclass),
data JSONB
);
在 go 项目中,我尝试从这张表中获取价值。
type TableGo struct {
Id int
Data string `gorm:"type:jsonb"`
}
table := TableGo{}
db.Where("id = ?", 75).Find(&table)
println(table.Data)
但是有(pq: relation "table_gos" does not exist)
如何在没有db.AutoMigrate(&TableGo{}) 的情况下链接结构表?
【问题讨论】:
标签: postgresql go go-gorm