Пример #1
0
func TestSelect__Sqlla(t *testing.T) {
	q := example.NewUserSQL().Select().Name("hogehoge")
	query, args, err := q.ToSql()
	if err != nil {
		t.Fatal("unexpected error:", err)
	}
	if query != "SELECT id, name FROM user WHERE name = ?;" {
		t.Fatal("unexpected query:", query)
	}
	if !reflect.DeepEqual(args, []interface{}{"hogehoge"}) {
		t.Fatal("unexpected args:", args)
	}
}
Пример #2
0
func BenchmarkSelect__Sqlla(b *testing.B) {
	for i := 0; i < b.N; i++ {
		q := example.NewUserSQL().Select().Name("hogehoge")
		q.ToSql()
	}
}