diff --git a/README.md b/README.md index 58510925..77169c52 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ DB.Save(&User{Name: "xxx"}) // table "users" ## Existing Schema -If you have an existing database schema and some of your tables do not follow the conventions, (and you can't rename your table names), please use: [Specifying The Table Name For A Struct Permanently With TableName](#specifying-the-table-name-for-a-struct-permanently-with-tableName). +If you have an existing database schema and some of your tables do not follow the conventions, (and you can't rename your table names), please use: [Specifying The Table Name For A Struct Permanently With TableName](#specifying-the-table-name-for-a-struct-permanently-with-tablename). If your primary key field is different from `id`, you can add a tag to the field structure to specify that this field is a primary key. diff --git a/main_test.go b/main_test.go index 24e01181..6f4061da 100644 --- a/main_test.go +++ b/main_test.go @@ -141,7 +141,7 @@ type Product struct { type Animal struct { Counter int64 `primaryKey:"yes"` Name string - From string //test reserverd sql keyword as field name + From string //test reserved sql keyword as field name CreatedAt time.Time UpdatedAt time.Time } @@ -1083,7 +1083,7 @@ func TestUpdate(t *testing.T) { } if db.First(&Product{}, "code = '789'").Error != nil { - t.Errorf("Product 456 should be changed to 789") + t.Errorf("Product 123 should be changed to 789") } if db.Model(product2).Update("CreatedAt", time.Now().Add(time.Hour)).Error != nil { @@ -1103,7 +1103,7 @@ func TestUpdate(t *testing.T) { } if db.First(&Animal{}, "name = 'Ferdinand'").Error == nil { - t.Errorf("Animal 'Fredinand' should be changed to 'Franz'") + t.Errorf("Animal 'Ferdinand' should be changed to 'Franz'") } if db.First(&Animal{}, "name = 'Robert'").Error != nil { @@ -1111,7 +1111,7 @@ func TestUpdate(t *testing.T) { } if db.First(&Animal{}, "name = 'Franz'").Error != nil { - t.Errorf("Product 'nerdz' should be changed to 'Franz'") + t.Errorf("Animal 'nerdz' should be changed to 'Franz'") } if db.Model(animal2).Update("CreatedAt", time.Now().Add(time.Hour)).Error != nil {