Merge pull request #165 from rtfb/typos

Various typo fixes
This commit is contained in:
Jinzhu 2014-07-13 19:08:25 +08:00
commit 96db2a1d15
2 changed files with 5 additions and 5 deletions

View File

@ -49,7 +49,7 @@ DB.Save(&User{Name: "xxx"}) // table "users"
## Existing Schema ## 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. 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.

View File

@ -141,7 +141,7 @@ type Product struct {
type Animal struct { type Animal struct {
Counter int64 `primaryKey:"yes"` Counter int64 `primaryKey:"yes"`
Name string Name string
From string //test reserverd sql keyword as field name From string //test reserved sql keyword as field name
CreatedAt time.Time CreatedAt time.Time
UpdatedAt time.Time UpdatedAt time.Time
} }
@ -1083,7 +1083,7 @@ func TestUpdate(t *testing.T) {
} }
if db.First(&Product{}, "code = '789'").Error != nil { 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 { 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 { 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 { 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 { 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 { if db.Model(animal2).Update("CreatedAt", time.Now().Add(time.Hour)).Error != nil {