mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
chore: use pgx v5 (#7577)
* chore: use pgx v5 * chore: update go version * remove direct pq dependency * remove unnecessary type * scan test * map scanner * converter * uint8 number array * duration * most unit tests work * unit tests work * chore: coverage * go 1.21 * linting * int64 gopfertammi * retry go 1.22 * retry go 1.22 * revert to go v1.21.5 * update go toolchain to 1.21.8 * go 1.21.8 * remove test flag * go 1.21.5 * linting * update toolchain * use correct array * use correct array * add byte array * correct value * correct error message * go 1.21 compatible
This commit is contained in:
@@ -10,8 +10,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/cockroachdb/cockroach-go/v2/crdb"
|
||||
"github.com/jackc/pgconn"
|
||||
"github.com/lib/pq"
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
"github.com/zitadel/logging"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/api/authz"
|
||||
@@ -438,11 +437,6 @@ func (db *CRDB) placeholder(query string) string {
|
||||
}
|
||||
|
||||
func (db *CRDB) isUniqueViolationError(err error) bool {
|
||||
if pqErr, ok := err.(*pq.Error); ok {
|
||||
if pqErr.Code == "23505" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if pgxErr, ok := err.(*pgconn.PgError); ok {
|
||||
if pgxErr.Code == "23505" {
|
||||
return true
|
||||
|
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/database"
|
||||
"github.com/zitadel/zitadel/internal/database/cockroach"
|
||||
db_mock "github.com/zitadel/zitadel/internal/database/mock"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
@@ -872,7 +873,7 @@ func (m *dbMock) expectQuery(t *testing.T, expectedQuery string, args []driver.V
|
||||
m.mock.ExpectBegin()
|
||||
query := m.mock.ExpectQuery(expectedQuery).WithArgs(args...)
|
||||
m.mock.ExpectCommit()
|
||||
rows := sqlmock.NewRows([]string{"sequence"})
|
||||
rows := m.mock.NewRows([]string{"sequence"})
|
||||
for _, event := range events {
|
||||
rows = rows.AddRow(event.Seq)
|
||||
}
|
||||
@@ -884,7 +885,7 @@ func (m *dbMock) expectQueryScanErr(t *testing.T, expectedQuery string, args []d
|
||||
m.mock.ExpectBegin()
|
||||
query := m.mock.ExpectQuery(expectedQuery).WithArgs(args...)
|
||||
m.mock.ExpectRollback()
|
||||
rows := sqlmock.NewRows([]string{"sequence"})
|
||||
rows := m.mock.NewRows([]string{"sequence"})
|
||||
for _, event := range events {
|
||||
rows = rows.AddRow(event.Seq)
|
||||
}
|
||||
@@ -900,7 +901,7 @@ func (m *dbMock) expectQueryErr(t *testing.T, expectedQuery string, args []drive
|
||||
|
||||
func newMockClient(t *testing.T) *dbMock {
|
||||
t.Helper()
|
||||
db, mock, err := sqlmock.New()
|
||||
db, mock, err := sqlmock.New(sqlmock.ValueConverterOption(new(db_mock.TypeConverter)))
|
||||
if err != nil {
|
||||
t.Errorf("unable to create mock client: %v", err)
|
||||
t.FailNow()
|
||||
|
Reference in New Issue
Block a user