📌  相关文章
📜  gorm 数组类型数据 postgres - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:44:59.877000             🧑  作者: Mango

代码示例1
type Game struct {                                           
        gorm.Model                                           
        GameCode    string                                      
        GameName    string                                      
        DeckType    pq.Int64Array `gorm:"type:integer[]"`
        GameEndDate string    
}   

// example insertion
dt := []int64{1, 2, 3}   
                                                                                
db.Create(&Game{GameCode: "xxx", GameName: "xxx", DeckType: pq.Int64Array(dt), GameEndDate: "xxx"})