这是我的模特type Ticket struct {    gorm.Model    PassengerName string         `json:"passenger_name"`    Price         uint64         `json:"price"`    Seat          pq.StringArray `gorm:"type:string[]" json:"seat"`}gorm.io/driver/postgres@v1.3.1/migrator.go:118 错误:类型“string[]”不存在(SQLSTATE 42704)
                    
                    
                2 回答
                            慕娘9325324
                            
                                
                            
                        
                        
                                                
                    TA贡献1783条经验 获得超5个赞
这不是一个好方法。你应该为它做一个单独的表
门票表:
type Ticket struct {
gorm.Model
PassengerName string `json:"passenger_name"`
Price uint64 `json:"price"`
Seat []Seat `json:"seat" gorm:"foreignKey:SeatId"` }
座位表:
type Seat struct {
gorm.Modal
SeatId serial `json:seat_id`
Seat string `json:"seat"`}
- 2 回答
 - 0 关注
 - 135 浏览
 
添加回答
举报
0/150
	提交
		取消
	