mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:48:07 +00:00
linting
This commit is contained in:
@@ -66,9 +66,9 @@ const (
|
|||||||
IntegrityTypeUnknown IntegrityType = "unknown"
|
IntegrityTypeUnknown IntegrityType = "unknown"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IntegrityViolation represents a generic integrity violation error.
|
// IntegrityViolationError represents a generic integrity violation error.
|
||||||
// It wraps the dialect specific original error to provide more context.
|
// It wraps the dialect specific original error to provide more context.
|
||||||
type IntegrityViolation struct {
|
type IntegrityViolationError struct {
|
||||||
integrityType IntegrityType
|
integrityType IntegrityType
|
||||||
table string
|
table string
|
||||||
constraint string
|
constraint string
|
||||||
@@ -76,7 +76,7 @@ type IntegrityViolation struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewIntegrityViolationError(typ IntegrityType, table, constraint string, original error) error {
|
func NewIntegrityViolationError(typ IntegrityType, table, constraint string, original error) error {
|
||||||
return &IntegrityViolation{
|
return &IntegrityViolationError{
|
||||||
integrityType: typ,
|
integrityType: typ,
|
||||||
table: table,
|
table: table,
|
||||||
constraint: constraint,
|
constraint: constraint,
|
||||||
@@ -84,25 +84,25 @@ func NewIntegrityViolationError(typ IntegrityType, table, constraint string, ori
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *IntegrityViolation) Error() string {
|
func (e *IntegrityViolationError) Error() string {
|
||||||
return fmt.Sprintf("integrity violation of type %q on %q (constraint: %q): %v", e.integrityType, e.table, e.constraint, e.original)
|
return fmt.Sprintf("integrity violation of type %q on %q (constraint: %q): %v", e.integrityType, e.table, e.constraint, e.original)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *IntegrityViolation) Is(target error) bool {
|
func (e *IntegrityViolationError) Is(target error) bool {
|
||||||
_, ok := target.(*IntegrityViolation)
|
_, ok := target.(*IntegrityViolationError)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckError is returned when a check constraint fails.
|
// CheckError is returned when a check constraint fails.
|
||||||
// It wraps the [IntegrityViolation] to provide more context.
|
// It wraps the [IntegrityViolationError] to provide more context.
|
||||||
// It is used to indicate that a check constraint was violated during an insert or update operation.
|
// It is used to indicate that a check constraint was violated during an insert or update operation.
|
||||||
type CheckError struct {
|
type CheckError struct {
|
||||||
IntegrityViolation
|
IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCheckError(table, constraint string, original error) error {
|
func NewCheckError(table, constraint string, original error) error {
|
||||||
return &CheckError{
|
return &CheckError{
|
||||||
IntegrityViolation: IntegrityViolation{
|
IntegrityViolationError: IntegrityViolationError{
|
||||||
integrityType: IntegrityTypeCheck,
|
integrityType: IntegrityTypeCheck,
|
||||||
table: table,
|
table: table,
|
||||||
constraint: constraint,
|
constraint: constraint,
|
||||||
@@ -117,19 +117,19 @@ func (e *CheckError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *CheckError) Unwrap() error {
|
func (e *CheckError) Unwrap() error {
|
||||||
return &e.IntegrityViolation
|
return &e.IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
// UniqueError is returned when a unique constraint fails.
|
// UniqueError is returned when a unique constraint fails.
|
||||||
// It wraps the [IntegrityViolation] to provide more context.
|
// It wraps the [IntegrityViolationError] to provide more context.
|
||||||
// It is used to indicate that a unique constraint was violated during an insert or update operation.
|
// It is used to indicate that a unique constraint was violated during an insert or update operation.
|
||||||
type UniqueError struct {
|
type UniqueError struct {
|
||||||
IntegrityViolation
|
IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUniqueError(table, constraint string, original error) error {
|
func NewUniqueError(table, constraint string, original error) error {
|
||||||
return &UniqueError{
|
return &UniqueError{
|
||||||
IntegrityViolation: IntegrityViolation{
|
IntegrityViolationError: IntegrityViolationError{
|
||||||
integrityType: IntegrityTypeUnique,
|
integrityType: IntegrityTypeUnique,
|
||||||
table: table,
|
table: table,
|
||||||
constraint: constraint,
|
constraint: constraint,
|
||||||
@@ -144,19 +144,19 @@ func (e *UniqueError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *UniqueError) Unwrap() error {
|
func (e *UniqueError) Unwrap() error {
|
||||||
return &e.IntegrityViolation
|
return &e.IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
// ForeignKeyError is returned when a foreign key constraint fails.
|
// ForeignKeyError is returned when a foreign key constraint fails.
|
||||||
// It wraps the [IntegrityViolation] to provide more context.
|
// It wraps the [IntegrityViolationError] to provide more context.
|
||||||
// It is used to indicate that a foreign key constraint was violated during an insert or update operation
|
// It is used to indicate that a foreign key constraint was violated during an insert or update operation
|
||||||
type ForeignKeyError struct {
|
type ForeignKeyError struct {
|
||||||
IntegrityViolation
|
IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewForeignKeyError(table, constraint string, original error) error {
|
func NewForeignKeyError(table, constraint string, original error) error {
|
||||||
return &ForeignKeyError{
|
return &ForeignKeyError{
|
||||||
IntegrityViolation: IntegrityViolation{
|
IntegrityViolationError: IntegrityViolationError{
|
||||||
integrityType: IntegrityTypeForeign,
|
integrityType: IntegrityTypeForeign,
|
||||||
table: table,
|
table: table,
|
||||||
constraint: constraint,
|
constraint: constraint,
|
||||||
@@ -171,19 +171,19 @@ func (e *ForeignKeyError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *ForeignKeyError) Unwrap() error {
|
func (e *ForeignKeyError) Unwrap() error {
|
||||||
return &e.IntegrityViolation
|
return &e.IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotNullError is returned when a not null constraint fails.
|
// NotNullError is returned when a not null constraint fails.
|
||||||
// It wraps the [IntegrityViolation] to provide more context.
|
// It wraps the [IntegrityViolationError] to provide more context.
|
||||||
// It is used to indicate that a not null constraint was violated during an insert or update operation.
|
// It is used to indicate that a not null constraint was violated during an insert or update operation.
|
||||||
type NotNullError struct {
|
type NotNullError struct {
|
||||||
IntegrityViolation
|
IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNotNullError(table, constraint string, original error) error {
|
func NewNotNullError(table, constraint string, original error) error {
|
||||||
return &NotNullError{
|
return &NotNullError{
|
||||||
IntegrityViolation: IntegrityViolation{
|
IntegrityViolationError: IntegrityViolationError{
|
||||||
integrityType: IntegrityTypeNotNull,
|
integrityType: IntegrityTypeNotNull,
|
||||||
table: table,
|
table: table,
|
||||||
constraint: constraint,
|
constraint: constraint,
|
||||||
@@ -198,7 +198,7 @@ func (e *NotNullError) Is(target error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *NotNullError) Unwrap() error {
|
func (e *NotNullError) Unwrap() error {
|
||||||
return &e.IntegrityViolation
|
return &e.IntegrityViolationError
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnknownError is returned when an unknown error occurs.
|
// UnknownError is returned when an unknown error occurs.
|
||||||
|
Reference in New Issue
Block a user