Commit 36f19955 authored by Shane O'Neill's avatar Shane O'Neill

Changed direct attribute access to method access

parent d9e71f38
......@@ -601,7 +601,7 @@ func BenchmarkNativeCrud(b *testing.B) {
for i := 0; i < b.N; i++ {
if len(suffix) == 0 {
res, err := dbmap.Db.Exec(insert, inv.Created, inv.Updated, inv.Memo, inv.PersonID)
res, err := dbmap.GetDb().Exec(insert, inv.Created, inv.Updated, inv.Memo, inv.PersonID)
if err != nil {
panic(err)
}
......@@ -612,7 +612,7 @@ func BenchmarkNativeCrud(b *testing.B) {
}
inv.ID = newid
} else {
rows, err := dbmap.Db.Query(insert, inv.Created, inv.Updated, inv.Memo, inv.PersonID)
rows, err := dbmap.GetDb().Query(insert, inv.Created, inv.Updated, inv.Memo, inv.PersonID)
if err != nil {
panic(err)
}
......@@ -627,7 +627,7 @@ func BenchmarkNativeCrud(b *testing.B) {
}
row := dbmap.Db.QueryRow(sel, inv.ID)
row := dbmap.GetDb().QueryRow(sel, inv.ID)
err = row.Scan(&inv.ID, &inv.Created, &inv.Updated, &inv.Memo, &inv.PersonID)
if err != nil {
panic(err)
......@@ -638,13 +638,13 @@ func BenchmarkNativeCrud(b *testing.B) {
inv.Memo = "my memo 2"
inv.PersonID = 3000
_, err = dbmap.Db.Exec(update, inv.Created, inv.Updated, inv.Memo,
_, err = dbmap.GetDb().Exec(update, inv.Created, inv.Updated, inv.Memo,
inv.PersonID, inv.ID)
if err != nil {
panic(err)
}
_, err = dbmap.Db.Exec(delete, inv.ID)
_, err = dbmap.GetDb().Exec(delete, inv.ID)
if err != nil {
panic(err)
}
......@@ -691,7 +691,7 @@ func BenchmarkModlCrud(b *testing.B) {
func initDbMapBench() *DbMap {
dbmap := newDbMap()
dbmap.Db.Exec("drop table if exists invoice_test")
dbmap.GetDb().Exec("drop table if exists invoice_test")
dbmap.AddTableWithName(Invoice{}, "invoice_test").SetKeys(true, "id")
err := dbmap.CreateTables()
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment