Properly abstract LastInsertID

This commit is contained in:
Aaron L 2016-08-13 16:27:34 -07:00
parent ef03225024
commit 944303f2f5
9 changed files with 93 additions and 94 deletions

View file

@ -20,6 +20,10 @@ func (t testInterface) Columns(tableName string) ([]Column, error) {
return testCols, nil
}
func (t testInterface) UseLastInsertID() bool {
return false
}
var testPkey = &PrimaryKey{Name: "pkey1", Columns: []string{"col1", "col2"}}
func (t testInterface) PrimaryKeyInfo(tableName string) (*PrimaryKey, error) {
@ -223,14 +227,3 @@ func TestSetRelationships(t *testing.T) {
t.Error("should not be a join table")
}
}
func TestDriverUsesLastInsertID(t *testing.T) {
t.Parallel()
if DriverUsesLastInsertID("postgres") {
t.Error("postgres does not support LastInsertId")
}
if !DriverUsesLastInsertID("mysql") {
t.Error("postgres does support LastInsertId")
}
}