diff --git a/README.md b/README.md index 04ba500..b0d5a5d 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)