我希望能够将一个bigint数组写入一个表中,以便在Go中用于历史记录.不幸的是,我不能这样做,当我这样做的错误sql: converting Exec argument #1's type: unsupported type []int64, a slice
抛出.以下是我正在做的,为了简洁而编辑:
type Card struct {
cid int64
}
type Transaction struct {
tid, cardid int64
productids []int64
salepoint int
cardkey string
}
func logPurchase(card *Card, t *Transaction) {
_, err := db.Exec("INSERT INTO history VALUES ($1, $2, $3, $4)", rand.Int63(), t.productids, card.cid, t.salepoint);
}
以下是我希望插入的表格 struct :