Commit 0e5562cc authored by Jason Moiron's avatar Jason Moiron

upstream abc01bc429c1b1c264087711b823e578ba666d3b, more or less

parent b5fa7103
......@@ -12,7 +12,6 @@ package modl
import (
"bytes"
"database/sql"
"errors"
"fmt"
"github.com/jmoiron/sqlx"
"reflect"
......@@ -774,7 +773,7 @@ func insert(m *DbMap, exec SqlExecutor, list ...interface{}) error {
if (k == reflect.Int) || (k == reflect.Int16) || (k == reflect.Int32) || (k == reflect.Int64) {
f.SetInt(id)
} else {
return errors.New(fmt.Sprintf("modl: Cannot set autoincrement value on non-Int field. SQL=%s autoIncrIdx=%d", bi.query, bi.autoIncrIdx))
return fmt.Errorf("modl: Cannot set autoincrement value on non-Int field. SQL=%s autoIncrIdx=%d", bi.query, bi.autoIncrIdx)
}
} else {
_, err := exec.Exec(bi.query, bi.args...)
......
......@@ -3,7 +3,6 @@ package modl
import (
"bytes"
"database/sql"
"errors"
"fmt"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
......@@ -69,7 +68,7 @@ func (p *Person) PreInsert(s SqlExecutor) error {
p.Created = time.Now().UnixNano()
p.Updated = p.Created
if p.FName == "badname" {
return errors.New(fmt.Sprintf("Invalid name: %s", p.FName))
return fmt.Errorf("Invalid name: %s", p.FName)
}
return 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