From 3587dbee4de80c637b9b59bc3df90473bfcdfa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Sat, 12 Jul 2014 13:31:12 +0300 Subject: [PATCH 1/3] Fix link to section in README It seems to be case sensitive, change tableName -> tablename. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 78948f1b7f9411bfdaa879cfd6e08c2a581024dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Sat, 12 Jul 2014 13:32:53 +0300 Subject: [PATCH 2/3] Fix couple cosmetic typos --- main_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_test.go b/main_test.go index 24e01181..018324da 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 } @@ -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 { From 6da7e8c64e381d0e126d1590ad6e7ab9c334f5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Sat, 12 Jul 2014 13:33:48 +0300 Subject: [PATCH 3/3] Fix couple misleading test failure messages --- main_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main_test.go b/main_test.go index 018324da..6f4061da 100644 --- a/main_test.go +++ b/main_test.go @@ -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 { @@ -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 {