From 04319bb3f1ac629669663a8bd11f2a8fb729ea8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2025 21:51:34 +0000 Subject: [PATCH 1/3] Bump github.com/go-sql-driver/mysql from 1.8.1 to 1.9.0 Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.8.1 to 1.9.0. - [Release notes](https://github.com/go-sql-driver/mysql/releases) - [Changelog](https://github.com/go-sql-driver/mysql/blob/master/CHANGELOG.md) - [Commits](https://github.com/go-sql-driver/mysql/compare/v1.8.1...v1.9.0) --- updated-dependencies: - dependency-name: github.com/go-sql-driver/mysql dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fade9ff..c1a4e11 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 // used by jet generator require ( - github.com/go-sql-driver/mysql v1.8.1 + github.com/go-sql-driver/mysql v1.9.0 github.com/google/uuid v1.6.0 github.com/jackc/pgconn v1.14.3 github.com/jackc/pgtype v1.14.4 diff --git a/go.sum b/go.sum index 72c0584..038cc76 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/friendsofgo/errors v0.9.2 h1:X6NYxef4efCBdwI7BgS820zFaN7Cphrmb+Pljdzj github.com/friendsofgo/errors v0.9.2/go.mod h1:yCvFW5AkDIL9qn7suHVLiI/gH228n7PC4Pn44IGoTOI= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= -github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= +github.com/go-sql-driver/mysql v1.9.0 h1:Y0zIbQXhQKmQgTp44Y1dp3wTXcn804QoTptLZT1vtvo= +github.com/go-sql-driver/mysql v1.9.0/go.mod h1:pDetrLJeA3oMujJuvXc8RJoasr589B6A9fwzD3QMrqw= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= From 71f0a2c7765b338f01a9068ec1375523e6cb990c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 21:17:24 +0000 Subject: [PATCH 2/3] Bump github.com/google/go-cmp from 0.6.0 to 0.7.0 Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/google/go-cmp/releases) - [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: github.com/google/go-cmp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fade9ff..d77787d 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( // used in tests require ( - github.com/google/go-cmp v0.6.0 + github.com/google/go-cmp v0.7.0 github.com/pkg/profile v1.7.0 github.com/shopspring/decimal v1.4.0 github.com/stretchr/testify v1.10.0 diff --git a/go.sum b/go.sum index 72c0584..3f3b664 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y= github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= From 33c1d9e66375edebb716333b794d1e84e5c67f81 Mon Sep 17 00:00:00 2001 From: go-jet Date: Tue, 4 Mar 2025 19:57:42 +0100 Subject: [PATCH 3/3] Reintroduce Uint64 literal constructor for postgres dialect. --- cmd/jet/version.go | 2 +- postgres/literal.go | 5 +++++ postgres/literal_test.go | 5 +++++ tests/postgres/alltypes_test.go | 13 +++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cmd/jet/version.go b/cmd/jet/version.go index 3300008..f5371e4 100644 --- a/cmd/jet/version.go +++ b/cmd/jet/version.go @@ -1,3 +1,3 @@ package main -const version = "v2.11.1" +const version = "v2.12.0" diff --git a/postgres/literal.go b/postgres/literal.go index 4f1c2c8..d070c77 100644 --- a/postgres/literal.go +++ b/postgres/literal.go @@ -49,6 +49,11 @@ func Uint32(value uint32) IntegerExpression { return CAST(jet.Uint32(value)).AS_BIGINT() } +// Uint64 is constructor for 64 bit unsigned integer expressions literals. +func Uint64(value uint64) IntegerExpression { + return CAST(jet.Uint64(value)).AS_BIGINT() +} + // Float creates new float literal expression var Float = jet.Float diff --git a/postgres/literal_test.go b/postgres/literal_test.go index 7147573..b788098 100644 --- a/postgres/literal_test.go +++ b/postgres/literal_test.go @@ -49,6 +49,11 @@ func TestUint32(t *testing.T) { assertSerialize(t, Uint32(val), `$1::bigint`, val) } +func TestUint64(t *testing.T) { + val := uint32(math.MaxUint32) + assertSerialize(t, Uint32(val), `$1::bigint`, val) +} + func TestFloat(t *testing.T) { assertSerialize(t, Float(12.34), `$1`, float64(12.34)) diff --git a/tests/postgres/alltypes_test.go b/tests/postgres/alltypes_test.go index 6c3755a..e720e24 100644 --- a/tests/postgres/alltypes_test.go +++ b/tests/postgres/alltypes_test.go @@ -3,6 +3,7 @@ package postgres import ( "github.com/go-jet/jet/v2/internal/utils/ptr" "github.com/stretchr/testify/assert" + "math" "github.com/go-jet/jet/v2/qrm" "testing" @@ -715,6 +716,18 @@ LIMIT $38; testutils.AssertJSONFile(t, dest, "./testdata/results/common/float_operators.json") } +func TestUInt64Overflow(t *testing.T) { + stmt := AllTypes.INSERT(AllTypes.BigInt). + VALUES(Uint64(math.MaxUint64)) + + _, err := stmt.Exec(db) + if isPgxDriver() { + require.ErrorContains(t, err, "18446744073709551615 is greater than maximum value for Int8") + } else { + require.ErrorContains(t, err, "sql: converting argument $1 type: uint64 values with high bit set are not supported") + } +} + func TestIntegerOperators(t *testing.T) { skipForCockroachDB(t) // some functions are still unimplemented