MCPcopy Index your code
hub / github.com/Masterminds/structable / TestPlainStructInsert

Function TestPlainStructInsert

sqlite_pod_test.go:42–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestPlainStructInsert(t *testing.T) {
43
44 db := getLanguagesDb()
45
46 l := &Language{
47 Id: -1,
48 Name: "Go",
49 Version: "1.3",
50 DtRelease: time.Date(2014, time.June, 18, 0, 0, 0, 0, time.UTC)}
51 l.Recorder = New(squirrel.NewStmtCacheProxy(db), "mysql").Bind("languages", l)
52
53 if err := l.Insert(); err != nil {
54 t.Fatalf("Failed Insert: %s", err)
55 }
56
57 lsql := new(Language)
58 lsql.loadFromSql(l.Id, db)
59 if !l.equals(lsql) {
60 t.Fatal("Loaded and inserted objects should be equivalent")
61 }
62}
63
64func TestPlainStructLoad(t *testing.T) {
65

Callers

nothing calls this directly

Calls 6

equalsMethod · 0.95
getLanguagesDbFunction · 0.85
NewFunction · 0.85
BindMethod · 0.65
InsertMethod · 0.65
loadFromSqlMethod · 0.45

Tested by

no test coverage detected