用户登录和接口鉴权
This commit is contained in:
2
vendor/gorm.io/driver/postgres/error_translator.go
generated
vendored
2
vendor/gorm.io/driver/postgres/error_translator.go
generated
vendored
@@ -8,10 +8,12 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
)
|
||||
|
||||
// The error codes to map PostgreSQL errors to gorm errors, here is the PostgreSQL error codes reference https://www.postgresql.org/docs/current/errcodes-appendix.html.
|
||||
var errCodes = map[string]error{
|
||||
"23505": gorm.ErrDuplicatedKey,
|
||||
"23503": gorm.ErrForeignKeyViolated,
|
||||
"42703": gorm.ErrInvalidField,
|
||||
"23514": gorm.ErrCheckConstraintViolated,
|
||||
}
|
||||
|
||||
type ErrMessage struct {
|
||||
|
||||
12
vendor/gorm.io/driver/postgres/migrator.go
generated
vendored
12
vendor/gorm.io/driver/postgres/migrator.go
generated
vendored
@@ -38,6 +38,7 @@ WHERE
|
||||
`
|
||||
|
||||
var typeAliasMap = map[string][]string{
|
||||
"int": {"integer"},
|
||||
"int2": {"smallint"},
|
||||
"int4": {"integer"},
|
||||
"int8": {"bigint"},
|
||||
@@ -50,6 +51,15 @@ var typeAliasMap = map[string][]string{
|
||||
"timestamp with time zone": {"timestamptz"},
|
||||
"bool": {"boolean"},
|
||||
"boolean": {"bool"},
|
||||
"serial2": {"smallserial"},
|
||||
"serial4": {"serial"},
|
||||
"serial8": {"bigserial"},
|
||||
"varbit": {"bit varying"},
|
||||
"char": {"character"},
|
||||
"varchar": {"character varying"},
|
||||
"float4": {"real"},
|
||||
"float8": {"double precision"},
|
||||
"timetz": {"time with time zone"},
|
||||
}
|
||||
|
||||
type Migrator struct {
|
||||
@@ -312,7 +322,7 @@ func (m Migrator) AlterColumn(value interface{}, field string) error {
|
||||
fileType := clause.Expr{SQL: m.DataTypeOf(field)}
|
||||
// check for typeName and SQL name
|
||||
isSameType := true
|
||||
if fieldColumnType.DatabaseTypeName() != fileType.SQL {
|
||||
if !strings.EqualFold(fieldColumnType.DatabaseTypeName(), fileType.SQL) {
|
||||
isSameType = false
|
||||
// if different, also check for aliases
|
||||
aliases := m.GetTypeAliases(fieldColumnType.DatabaseTypeName())
|
||||
|
||||
Reference in New Issue
Block a user