You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
比如我拿到一个beedb.Model的orm
写出类似以下代码
orm := beedb.New(i.DB)
for _, v := range Logs {
value := v
orm.Save(&value)//做插入操作Id自增
}
这样的代码居然只能存循环的第一个
发现是orm.PrimaryKey变了
orm := beedb.New(i.DB)
for _, v := range Logs {
value := v
orm.SetPK("Id").Save(&value)//做插入操作Id自增
}
这样做就对了
或者:
for _, v := range Logs {
orm := beedb.New(i.DB)
value := v
orm.Save(&value)//做插入操作Id自增
}
这样做也行
这个是不是一个bug?
The text was updated successfully, but these errors were encountered:
比如我拿到一个beedb.Model的orm
写出类似以下代码
orm := beedb.New(i.DB)
for _, v := range Logs {
value := v
orm.Save(&value)//做插入操作Id自增
}
这样的代码居然只能存循环的第一个
发现是orm.PrimaryKey变了
orm := beedb.New(i.DB)
for _, v := range Logs {
value := v
orm.SetPK("Id").Save(&value)//做插入操作Id自增
}
这样做就对了
或者:
for _, v := range Logs {
orm := beedb.New(i.DB)
value := v
orm.Save(&value)//做插入操作Id自增
}
这样做也行
这个是不是一个bug?
The text was updated successfully, but these errors were encountered: