Tests folder structure reorganisation.
This commit is contained in:
parent
d0533f73fb
commit
6bf9c32c07
19 changed files with 22 additions and 24 deletions
|
|
@ -508,7 +508,7 @@ return result in one database call. Handler execution will be only proportional
|
||||||
ORM example replaced with jet will take just 30ms + 'result scan time' = 31ms (rough estimate).
|
ORM example replaced with jet will take just 30ms + 'result scan time' = 31ms (rough estimate).
|
||||||
|
|
||||||
With Jet you can even join the whole database and store the whole structured result in in one query call.
|
With Jet you can even join the whole database and store the whole structured result in in one query call.
|
||||||
This is exactly what is being done in one of the tests: [TestJoinEverything](/tests/chinook_db_test.go#L40).
|
This is exactly what is being done in one of the tests: [TestJoinEverything](/tests/postgres/chinook_db_test.go#L40).
|
||||||
The whole test database is joined and query result(~10,000 rows) is stored in a structured variable in less than 0.7s.
|
The whole test database is joined and query result(~10,000 rows) is stored in a structured variable in less than 0.7s.
|
||||||
|
|
||||||
##### How quickly bugs are found
|
##### How quickly bugs are found
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ FROM test_sample.all_types;
|
||||||
|
|
||||||
testutils.JsonPrint(dest)
|
testutils.JsonPrint(dest)
|
||||||
|
|
||||||
testutils.AssertJSONFile(t, "./testdata/common_db_results/bool_operators.json", dest)
|
testutils.AssertJSONFile(t, "./testdata/common/bool_operators.json", dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
var allTypesJson = `
|
var allTypesJson = `
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/go-jet/jet"
|
. "github.com/go-jet/jet"
|
||||||
|
|
@ -240,9 +240,7 @@ LIMIT $5;
|
||||||
|
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
testutils.JsonPrint(dest)
|
testutils.AssertJSONFile(t, "./testdata/common/bool_operators.json", dest)
|
||||||
|
|
||||||
testutils.AssertJSONFile(t, "./testdata/common_db_results/bool_operators.json", dest)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFloatOperators(t *testing.T) {
|
func TestFloatOperators(t *testing.T) {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
@ -102,7 +102,7 @@ func TestJoinEverything(t *testing.T) {
|
||||||
|
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
assert.Equal(t, len(dest), 275)
|
assert.Equal(t, len(dest), 275)
|
||||||
testutils.AssertJSONFile(t, "./testdata/joined_everything.json", dest)
|
testutils.AssertJSONFile(t, "./postgres/testdata/joined_everything.json", dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSelfJoin(t *testing.T) {
|
func TestSelfJoin(t *testing.T) {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-jet/jet/internal/testutils"
|
"github.com/go-jet/jet/internal/testutils"
|
||||||
|
|
@ -62,5 +62,5 @@ func TestNorthwindJoinEverything(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
//jsonSave("./testdata/northwind-all.json", dest)
|
//jsonSave("./testdata/northwind-all.json", dest)
|
||||||
testutils.AssertJSONFile(t, "./testdata/northwind-all.json", dest)
|
testutils.AssertJSONFile(t, "./postgres/testdata/northwind-all.json", dest)
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/go-jet/jet"
|
. "github.com/go-jet/jet"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/go-jet/jet"
|
. "github.com/go-jet/jet"
|
||||||
|
|
@ -182,7 +182,7 @@ func TestScanToStruct(t *testing.T) {
|
||||||
|
|
||||||
err := query.Query(db, &dest)
|
err := query.Query(db, &dest)
|
||||||
|
|
||||||
assert.Error(t, err, `Scan: unable to scan type int32 into UUID, at struct field: InventoryID uuid.UUID of type tests.Inventory. `)
|
assert.Error(t, err, `Scan: unable to scan type int32 into UUID, at struct field: InventoryID uuid.UUID of type postgres.Inventory. `)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/go-jet/jet"
|
. "github.com/go-jet/jet"
|
||||||
|
|
@ -1459,7 +1459,7 @@ ORDER BY actor.actor_id ASC, film.film_id ASC;
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
//jsonSave("./testdata/quick-start-dest.json", dest)
|
//jsonSave("./testdata/quick-start-dest.json", dest)
|
||||||
testutils.AssertJSONFile(t, "./testdata/quick-start-dest.json", dest)
|
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest.json", dest)
|
||||||
|
|
||||||
var dest2 []struct {
|
var dest2 []struct {
|
||||||
model.Category
|
model.Category
|
||||||
|
|
@ -1472,7 +1472,7 @@ ORDER BY actor.actor_id ASC, film.film_id ASC;
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
//jsonSave("./testdata/quick-start-dest2.json", dest2)
|
//jsonSave("./testdata/quick-start-dest2.json", dest2)
|
||||||
testutils.AssertJSONFile(t, "./testdata/quick-start-dest2.json", dest2)
|
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest2.json", dest2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQuickStartWithSubQueries(t *testing.T) {
|
func TestQuickStartWithSubQueries(t *testing.T) {
|
||||||
|
|
@ -1524,7 +1524,7 @@ func TestQuickStartWithSubQueries(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
//jsonSave("./testdata/quick-start-dest.json", dest)
|
//jsonSave("./testdata/quick-start-dest.json", dest)
|
||||||
testutils.AssertJSONFile(t, "./testdata/quick-start-dest.json", dest)
|
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest.json", dest)
|
||||||
|
|
||||||
var dest2 []struct {
|
var dest2 []struct {
|
||||||
model.Category
|
model.Category
|
||||||
|
|
@ -1537,5 +1537,5 @@ func TestQuickStartWithSubQueries(t *testing.T) {
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
//jsonSave("./testdata/quick-start-dest2.json", dest2)
|
//jsonSave("./testdata/quick-start-dest2.json", dest2)
|
||||||
testutils.AssertJSONFile(t, "./testdata/quick-start-dest2.json", dest2)
|
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest2.json", dest2)
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package tests
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-jet/jet"
|
"github.com/go-jet/jet"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue