From e0c3be03fba966a0128f4d215fa3743d0e8e9a6e Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Mon, 18 Mar 2024 16:28:46 +0800 Subject: [PATCH] Fix tests in local --- schema/serializer.go | 4 ++-- tests/docker-compose.yml | 1 + tests/go.mod | 17 +++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/schema/serializer.go b/schema/serializer.go index 397edff0..f500521e 100644 --- a/schema/serializer.go +++ b/schema/serializer.go @@ -126,12 +126,12 @@ func (UnixSecondSerializer) Value(ctx context.Context, field *Field, dst reflect rv := reflect.ValueOf(fieldValue) switch v := fieldValue.(type) { case int64, int, uint, uint64, int32, uint32, int16, uint16: - result = time.Unix(reflect.Indirect(rv).Int(), 0) + result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC() case *int64, *int, *uint, *uint64, *int32, *uint32, *int16, *uint16: if rv.IsZero() { return nil, nil } - result = time.Unix(reflect.Indirect(rv).Int(), 0) + result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC() default: err = fmt.Errorf("invalid field type %#v for UnixSecondSerializer, only int, uint supported", v) } diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 866a4d62..8abd4d0f 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -24,6 +24,7 @@ services: ports: - "9930:1433" environment: + - TZ=Asia/Shanghai - ACCEPT_EULA=Y - SA_PASSWORD=LoremIpsum86 - MSSQL_DB=gorm diff --git a/tests/go.mod b/tests/go.mod index 136667b7..350152d3 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -6,29 +6,30 @@ require ( github.com/google/uuid v1.6.0 github.com/jinzhu/now v1.1.5 github.com/lib/pq v1.10.9 - github.com/stretchr/testify v1.8.4 - gorm.io/driver/mysql v1.5.4 - gorm.io/driver/postgres v1.5.6 + github.com/stretchr/testify v1.9.0 + gorm.io/driver/mysql v1.5.5 + gorm.io/driver/postgres v1.5.7 gorm.io/driver/sqlite v1.5.5 gorm.io/driver/sqlserver v1.5.3 - gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde + gorm.io/gorm v1.25.7 ) require ( + filippo.io/edwards25519 v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-sql-driver/mysql v1.7.1 // indirect + github.com/go-sql-driver/mysql v1.8.0 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect - github.com/jackc/pgx/v5 v5.5.3 // indirect + github.com/jackc/pgx/v5 v5.5.5 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect - github.com/microsoft/go-mssqldb v1.6.0 // indirect + github.com/microsoft/go-mssqldb v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - golang.org/x/crypto v0.18.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect )