From ce4386604d4938915a73c2248abffe0a93d12745 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 29 Jun 2023 20:06:56 +0100 Subject: [PATCH] GORM v1.25.1. --- gormlite/error_translator.go | 2 +- gormlite/go.mod | 4 ++-- gormlite/go.sum | 8 ++++---- gormlite/test.sh | 6 +++--- gormlite/tests.patch | 29 ++++------------------------- 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/gormlite/error_translator.go b/gormlite/error_translator.go index c807a6e..ac7a2d2 100644 --- a/gormlite/error_translator.go +++ b/gormlite/error_translator.go @@ -15,7 +15,7 @@ func (dialector Dialector) Translate(err error) error { return gorm.ErrDuplicatedKey case errors.Is(err, sqlite3.CONSTRAINT_FOREIGNKEY): - return err // gorm.ErrForeignKeyViolated (gorm v1.25.2) + return gorm.ErrForeignKeyViolated } return err } diff --git a/gormlite/go.mod b/gormlite/go.mod index 8e61028..2902236 100644 --- a/gormlite/go.mod +++ b/gormlite/go.mod @@ -3,8 +3,8 @@ module github.com/ncruces/go-sqlite3/gormlite go 1.19 require ( - github.com/ncruces/go-sqlite3 v0.8.0 - gorm.io/gorm v1.25.1 + github.com/ncruces/go-sqlite3 v0.8.1 + gorm.io/gorm v1.25.2 ) require ( diff --git a/gormlite/go.sum b/gormlite/go.sum index df433d9..7cfe14f 100644 --- a/gormlite/go.sum +++ b/gormlite/go.sum @@ -2,13 +2,13 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/ncruces/go-sqlite3 v0.8.0 h1:9FsLTTPqHE/GyW42dGqe9KUXDt4QHRaKf67Lk7jvdIQ= -github.com/ncruces/go-sqlite3 v0.8.0/go.mod h1:EhHe1qvG6Zc/8ffYMzre8n//rTRs1YNN5dUD1f1mEGc= +github.com/ncruces/go-sqlite3 v0.8.1 h1:e1Y7uHu96xC4fWKsCVWprbTi8vAaQX9R+8kgkxOHWaY= +github.com/ncruces/go-sqlite3 v0.8.1/go.mod h1:EhHe1qvG6Zc/8ffYMzre8n//rTRs1YNN5dUD1f1mEGc= github.com/ncruces/julianday v0.1.5 h1:hDJ9ejiMp3DHsoZ5KW4c1lwfMjbARS7u/gbYcd0FBZk= github.com/ncruces/julianday v0.1.5/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= github.com/tetratelabs/wazero v1.2.1 h1:J4X2hrGzJvt+wqltuvcSjHQ7ujQxA9gb6PeMs4qlUWs= github.com/tetratelabs/wazero v1.2.1/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gorm.io/gorm v1.25.1 h1:nsSALe5Pr+cM3V1qwwQ7rOkw+6UeLrX5O4v3llhHa64= -gorm.io/gorm v1.25.1/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.2 h1:gs1o6Vsa+oVKG/a9ElL3XgyGfghFfkKA2SInQaCyMho= +gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= diff --git a/gormlite/test.sh b/gormlite/test.sh index 68d1571..7adfed4 100755 --- a/gormlite/test.sh +++ b/gormlite/test.sh @@ -3,8 +3,8 @@ set -euo pipefail cd -P -- "$(dirname -- "$0")" -rm -rf gorm/ tests/ -git clone --filter=blob:none --branch=v1.25.1 https://github.com/go-gorm/gorm.git +rm -rf gorm/ tests/ $TMPDIR/gorm.db +git clone --filter=blob:none https://github.com/go-gorm/gorm.git mv gorm/tests tests rm -rf gorm/ @@ -14,5 +14,5 @@ cd tests go mod tidy && go work use . && go test cd .. -rm -rf tests/ +rm -rf tests/ $TMPDIR/gorm.db go work use -r . \ No newline at end of file diff --git a/gormlite/tests.patch b/gormlite/tests.patch index 15cfc0c..91b76c9 100644 --- a/gormlite/tests.patch +++ b/gormlite/tests.patch @@ -1,51 +1,30 @@ diff --git a/tests/.gitignore b/tests/.gitignore -index 08cb523..72e8ffc 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1 +1 @@ -go.sum +* diff --git a/tests/go.mod b/tests/go.mod -index f47d175..84b80c2 100644 --- a/tests/go.mod +++ b/tests/go.mod -@@ -7,13 +7,13 @@ require ( +@@ -7,12 +7,12 @@ require ( github.com/jackc/pgx/v5 v5.3.1 // indirect github.com/jinzhu/now v1.1.5 github.com/lib/pq v1.10.8 - github.com/mattn/go-sqlite3 v1.14.16 // indirect + github.com/ncruces/go-sqlite3 v0.7.2 + github.com/ncruces/go-sqlite3/gormlite v0.0.0 - golang.org/x/crypto v0.8.0 // indirect gorm.io/driver/mysql v1.5.0 gorm.io/driver/postgres v1.5.0 - gorm.io/driver/sqlite v1.5.0 - gorm.io/driver/sqlserver v1.4.3 -- gorm.io/gorm v1.25.0 -+ gorm.io/gorm v1.25.1 + gorm.io/driver/sqlserver v1.5.1 +- gorm.io/gorm v1.25.1 ++ gorm.io/gorm v1.25.2 ) -replace gorm.io/gorm => ../ +replace github.com/ncruces/go-sqlite3/gormlite => ../ -diff --git a/tests/scanner_valuer_test.go b/tests/scanner_valuer_test.go -index 1412169..472434b 100644 ---- a/tests/scanner_valuer_test.go -+++ b/tests/scanner_valuer_test.go -@@ -170,10 +170,10 @@ func (data *EncryptedData) Scan(value interface{}) error { - return errors.New("Too short") - } - -- *data = b[3:] -+ *data = append((*data)[0:], b[3:]...) - return nil - } else if s, ok := value.(string); ok { -- *data = []byte(s)[3:] -+ *data = []byte(s[3:]) - return nil - } - diff --git a/tests/tests_test.go b/tests/tests_test.go -index 90eb847..cd9af43 100644 --- a/tests/tests_test.go +++ b/tests/tests_test.go @@ -7,9 +7,11 @@ import (