Пример #1
0
func TestInit(t *testing.T) {
	Conn.Connect(CD)
	Conn.Query(&ps.Stmt{make([]string, 0), "CREATE TABLE test(Someid integer primary key auto_increment, SomeText Char(255), i integer);"})
	for i := 0; i < 10; i++ {
		ps.Save(NewTest("test"+strconv.Itoa(i), i%3))
	}
}
Пример #2
0
func TestInit(t *testing.T) {
	Conn.Connect(CD)
	Conn.Query(&ps.Stmt{make([]string, 0), "CREATE TABLE test(Someid Serial, SomeText Char(255), i int);"})

	for i := 0; i < 10; i++ {
		ps.Save(NewTest("test"+strconv.Itoa(i), i%3))
	}
}
Пример #3
0
func TestDefaultConnection(t *testing.T) {
	//TODO: Gdy nie ma polaczenia idzie panic... slaaabo!
	Conn.Connect(CD)
	//insert
	tt := NewTest("łopata", 10)
	v, id := ps.Save(tt)
	//update
	tt2, ok := v.(*Test)
	if ok {
		t.Log(tt2.Someid.String())
		tt2.SomeText.Value("update")
		_, id2 := ps.Save(tt2)
		if id != id2 {
			t.Error("Inserted twice " + id + " " + id2)
		}
	}
	/**/
}