Fix tests in local

This commit is contained in:
Jinzhu 2024-03-18 16:28:46 +08:00
parent 303de6e7c8
commit e0c3be03fb
3 changed files with 12 additions and 10 deletions

View File

@ -126,12 +126,12 @@ func (UnixSecondSerializer) Value(ctx context.Context, field *Field, dst reflect
rv := reflect.ValueOf(fieldValue) rv := reflect.ValueOf(fieldValue)
switch v := fieldValue.(type) { switch v := fieldValue.(type) {
case int64, int, uint, uint64, int32, uint32, int16, uint16: 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: case *int64, *int, *uint, *uint64, *int32, *uint32, *int16, *uint16:
if rv.IsZero() { if rv.IsZero() {
return nil, nil return nil, nil
} }
result = time.Unix(reflect.Indirect(rv).Int(), 0) result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC()
default: default:
err = fmt.Errorf("invalid field type %#v for UnixSecondSerializer, only int, uint supported", v) err = fmt.Errorf("invalid field type %#v for UnixSecondSerializer, only int, uint supported", v)
} }

View File

@ -24,6 +24,7 @@ services:
ports: ports:
- "9930:1433" - "9930:1433"
environment: environment:
- TZ=Asia/Shanghai
- ACCEPT_EULA=Y - ACCEPT_EULA=Y
- SA_PASSWORD=LoremIpsum86 - SA_PASSWORD=LoremIpsum86
- MSSQL_DB=gorm - MSSQL_DB=gorm

View File

@ -6,29 +6,30 @@ require (
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/jinzhu/now v1.1.5 github.com/jinzhu/now v1.1.5
github.com/lib/pq v1.10.9 github.com/lib/pq v1.10.9
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.9.0
gorm.io/driver/mysql v1.5.4 gorm.io/driver/mysql v1.5.5
gorm.io/driver/postgres v1.5.6 gorm.io/driver/postgres v1.5.7
gorm.io/driver/sqlite v1.5.5 gorm.io/driver/sqlite v1.5.5
gorm.io/driver/sqlserver v1.5.3 gorm.io/driver/sqlserver v1.5.3
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde gorm.io/gorm v1.25.7
) )
require ( require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // 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/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // 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/jinzhu/inflection v1.0.0 // indirect
github.com/kr/text v0.2.0 // indirect github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // 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/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.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 golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )