From 0dca8ffc9c83fa6c0cca32e0e28873f11ae00a80 Mon Sep 17 00:00:00 2001 From: Gregory Rehm Date: Tue, 10 Sep 2013 23:32:18 -0700 Subject: [PATCH 1/2] Fix for Issue #73 Fixed the basic example so that CreateTable is called inside a transaction --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 04ba500..08e6dfe 100644 --- a/README.md +++ b/README.md @@ -270,18 +270,13 @@ func main() { panic(err) } - // Create a table + // Define a table's structure and data type Fruit struct { Id hood.Id Name string `validate:"presence"` Color string } - err = hd.CreateTable(&Fruit{}) - if err != nil { - panic(err) - } - fruits := []Fruit{ Fruit{Name: "banana", Color: "yellow"}, Fruit{Name: "apple", Color: "red"}, @@ -292,7 +287,13 @@ func main() { // Start a transaction tx := hd.Begin() - + + // Create the Fruit Table + err = tx.CreateTable(&Fruit{}) + if err != nil { + panic(err) + } + ids, err := tx.SaveAll(&fruits) if err != nil { panic(err) From 4745eaaa4335b6fe6d7f031c37f4b5441f8f62df Mon Sep 17 00:00:00 2001 From: Gregory Rehm Date: Tue, 10 Sep 2013 23:34:33 -0700 Subject: [PATCH 2/2] Fixed whitespace issue There was some whitespace weirdness the first go around when I implemented my fix. This itself has been fixed... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08e6dfe..b0d5a5d 100644 --- a/README.md +++ b/README.md @@ -289,7 +289,7 @@ func main() { tx := hd.Begin() // Create the Fruit Table - err = tx.CreateTable(&Fruit{}) + err = tx.CreateTable(&Fruit{}) if err != nil { panic(err) }