jet/tests/postgres/util_test.go

59 lines
1.7 KiB
Go
Raw Normal View History

2019-07-30 11:45:10 +02:00
package postgres
2019-05-12 18:15:23 +02:00
import (
2019-08-03 14:10:47 +02:00
"github.com/go-jet/jet/internal/jet"
2019-07-29 18:08:53 +02:00
"github.com/go-jet/jet/internal/testutils"
2019-06-24 10:01:34 +02:00
"github.com/go-jet/jet/tests/.gentestdata/jetdb/dvds/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
2019-05-12 18:15:23 +02:00
"testing"
)
2019-08-02 11:08:24 +02:00
func AssertExec(t *testing.T, stmt jet.Statement, rowsAffected int64) {
res, err := stmt.Exec(db)
require.NoError(t, err)
rows, err := res.RowsAffected()
assert.NoError(t, err)
assert.Equal(t, rows, rowsAffected)
}
2019-05-12 18:15:23 +02:00
var customer0 = model.Customer{
CustomerID: 1,
StoreID: 1,
FirstName: "Mary",
LastName: "Smith",
2020-05-02 22:15:38 +02:00
Email: testutils.StringPtr("mary.smith@sakilacustomer.org"),
2019-05-20 17:37:55 +02:00
AddressID: 5,
2019-05-12 18:15:23 +02:00
Activebool: true,
2019-07-29 18:08:53 +02:00
CreateDate: *testutils.TimestampWithoutTimeZone("2006-02-14 00:00:00", 0),
LastUpdate: testutils.TimestampWithoutTimeZone("2013-05-26 14:49:45.738", 3),
2020-05-02 22:15:38 +02:00
Active: testutils.Int32Ptr(1),
2019-05-12 18:15:23 +02:00
}
var customer1 = model.Customer{
CustomerID: 2,
StoreID: 1,
FirstName: "Patricia",
LastName: "Johnson",
2020-05-02 22:15:38 +02:00
Email: testutils.StringPtr("patricia.johnson@sakilacustomer.org"),
2019-05-20 17:37:55 +02:00
AddressID: 6,
2019-05-12 18:15:23 +02:00
Activebool: true,
2019-07-29 18:08:53 +02:00
CreateDate: *testutils.TimestampWithoutTimeZone("2006-02-14 00:00:00", 0),
LastUpdate: testutils.TimestampWithoutTimeZone("2013-05-26 14:49:45.738", 3),
2020-05-02 22:15:38 +02:00
Active: testutils.Int32Ptr(1),
2019-05-12 18:15:23 +02:00
}
var lastCustomer = model.Customer{
CustomerID: 599,
StoreID: 2,
FirstName: "Austin",
LastName: "Cintron",
2020-05-02 22:15:38 +02:00
Email: testutils.StringPtr("austin.cintron@sakilacustomer.org"),
2019-05-20 17:37:55 +02:00
AddressID: 605,
2019-05-12 18:15:23 +02:00
Activebool: true,
2019-07-29 18:08:53 +02:00
CreateDate: *testutils.TimestampWithoutTimeZone("2006-02-14 00:00:00", 0),
LastUpdate: testutils.TimestampWithoutTimeZone("2013-05-26 14:49:45.738", 3),
2020-05-02 22:15:38 +02:00
Active: testutils.Int32Ptr(1),
2019-05-12 18:15:23 +02:00
}