跳到主要内容

更新

普通更新操作:

batis.Update("products", map[string]any{
"updated_at": time.Now(),
},
batis.Where("id = #{user.Id}", batis.Param("user",user)),
)

限制更新 1 条记录:

batis.Affect(1).Update("products", map[string]any{
"updated_at": time.Now(),
},
batis.Where("id = #{user.Id}", batis.Param("user",user)),
)

限制更新至少 1 条记录:

batis.Affect("1+").Update("products", map[string]any{
"updated_at": time.Now(),
},
batis.Where("id = #{user.Id}", batis.Param("user",user)),
)