@@ -436,11 +436,13 @@ type InvoicePersonView struct {
436
436
437
437
// Create some rows
438
438
p1 := &Person{0 , 0 , 0 , " bob" , " smith" }
439
- dbmap.Insert (p1)
439
+ err = dbmap.Insert (p1)
440
+ checkErr (err, " Insert failed" )
440
441
441
442
// notice how we can wire up p1.Id to the invoice easily
442
443
inv1 := &Invoice{0 , 0 , 0 , " xmas order" , p1.Id }
443
- dbmap.Insert (inv1)
444
+ err = dbmap.Insert (inv1)
445
+ checkErr (err, " Insert failed" )
444
446
445
447
// Run your query
446
448
query := " select i.Id InvoiceId, p.Id PersonId, i.Memo, p.FName " +
@@ -503,9 +505,12 @@ func InsertInv(dbmap *DbMap, inv *Invoice, per *Person) error {
503
505
return err
504
506
}
505
507
506
- trans.Insert (per)
508
+ err = trans.Insert (per)
509
+ checkErr (err, " Insert failed" )
510
+
507
511
inv.PersonId = per.Id
508
- trans.Insert (inv)
512
+ err = trans.Insert (inv)
513
+ checkErr (err, " Insert failed" )
509
514
510
515
// if the commit is successful, a nil error is returned
511
516
return trans.Commit ()
@@ -591,12 +596,14 @@ type Person struct {
591
596
}
592
597
593
598
p1 := &Person{0 , 0 , 0 , " Bob" , " Smith" , 0 }
594
- dbmap.Insert (p1) // Version is now 1
599
+ err = dbmap.Insert (p1) // Version is now 1
600
+ checkErr (err, " Insert failed" )
595
601
596
602
obj , err := dbmap.Get (Person{}, p1.Id )
597
603
p2 := obj.(*Person)
598
604
p2.LName = " Edwards"
599
- dbmap.Update (p2) // Version is now 2
605
+ _,err = dbmap.Update (p2) // Version is now 2
606
+ checkErr (err, " Update failed" )
600
607
601
608
p1.LName = " Howard"
602
609
0 commit comments