删除


  1. var d Dbtest
  2. d.Id = 10
  3. dao := NewDbtestDao()
  4. affect, err := dao.Delete(&d)
  5. //先查后删
  6. dao := NewDbtestDao(session)
  7. param := dbdao.CastToParamIn([]int{10})
  8. lists, err := dao.Get(param)
  9. if err != nil {
  10. return err
  11. }
  12. if len(lists) > 0 {
  13. row := lists[0]
  14. affect, err := dao.Delete(&row)
  15. }