(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestPlainStructLoadWhere(t *testing.T) { |
| 90 | |
| 91 | db := getLanguagesDb() |
| 92 | |
| 93 | var lastId int64 |
| 94 | if res, err := db.Exec("INSERT INTO languages (name, version, dt_release) VALUES ('Scala', '2.11.7', '2015-06-23')"); err != nil { |
| 95 | t.Fatalf("Sqlite Exec failed: %s", err) |
| 96 | } else if lastId, err = res.LastInsertId(); err != nil { |
| 97 | t.Fatalf("Sqlite LastInsertId failed: %s", err) |
| 98 | } |
| 99 | |
| 100 | lsql := &Language{ |
| 101 | Id: -1, |
| 102 | Name: "Scala", |
| 103 | Version: "2.11.7", |
| 104 | DtRelease: time.Date(2015, time.June, 23, 0, 0, 0, 0, time.UTC)} |
| 105 | |
| 106 | l := &Language{Id: lastId} |
| 107 | l.Recorder = New(squirrel.NewStmtCacheProxy(db), "mysql").Bind("languages", l) |
| 108 | if err := l.LoadWhere("version = ?", "2.11.7"); err != nil { |
| 109 | t.Fatalf("Failed LoadWhere: %s", err) |
| 110 | } |
| 111 | |
| 112 | lsql.Id = lastId |
| 113 | if !l.equals(lsql) { |
| 114 | t.Fatal("Loaded and inserted objects should be equivalent") |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | func TestPlainStructUpdate(t *testing.T) { |
| 119 |
nothing calls this directly
no test coverage detected