Yay, users inserted

This commit is contained in:
Jinzhu 2013-10-26 10:15:09 +08:00
parent c26e10813d
commit 0b1facc513
2 changed files with 2 additions and 6 deletions

2
orm.go
View File

@ -26,7 +26,7 @@ type Orm struct {
}
func (s *Orm) setModel(model interface{}) (err error) {
s.TableName = "user"
s.TableName = "users"
s.PrimaryKey = "id"
return
}

View File

@ -2,7 +2,6 @@ package gorm
import (
"fmt"
"time"
"testing"
)
@ -19,10 +18,7 @@ func getDB() DB {
func TestSaveAndFirst(t *testing.T) {
db := getDB()
u := &User{Name: "jinzhu"}
fmt.Println("*******")
fmt.Println(db.Save(u).Sql)
fmt.Println(db.Save(u).Error)
fmt.Println(time.Now().String())
db.Save(u)
user := &User{}
db.First(&user)