2020-01-30 10:14:48 +03:00
|
|
|
package gorm
|
|
|
|
|
2020-01-31 01:35:25 +03:00
|
|
|
import (
|
|
|
|
"errors"
|
2021-04-09 05:20:36 +03:00
|
|
|
|
|
|
|
"gorm.io/gorm/logger"
|
2020-01-31 01:35:25 +03:00
|
|
|
)
|
2020-01-30 10:14:48 +03:00
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrRecordNotFound record not found error
|
2021-04-09 05:20:36 +03:00
|
|
|
ErrRecordNotFound = logger.ErrRecordNotFound
|
2020-01-30 10:14:48 +03:00
|
|
|
// ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback`
|
2021-05-17 10:53:48 +03:00
|
|
|
ErrInvalidTransaction = errors.New("invalid transaction")
|
2020-02-20 18:04:03 +03:00
|
|
|
// ErrNotImplemented not implemented
|
|
|
|
ErrNotImplemented = errors.New("not implemented")
|
2020-03-08 09:51:52 +03:00
|
|
|
// ErrMissingWhereClause missing where clause
|
2020-05-31 18:55:56 +03:00
|
|
|
ErrMissingWhereClause = errors.New("WHERE conditions required")
|
2020-05-07 05:03:48 +03:00
|
|
|
// ErrUnsupportedRelation unsupported relations
|
|
|
|
ErrUnsupportedRelation = errors.New("unsupported relations")
|
2020-07-26 05:03:58 +03:00
|
|
|
// ErrPrimaryKeyRequired primary keys required
|
|
|
|
ErrPrimaryKeyRequired = errors.New("primary key required")
|
|
|
|
// ErrModelValueRequired model value required
|
|
|
|
ErrModelValueRequired = errors.New("model value required")
|
2023-02-08 08:40:41 +03:00
|
|
|
// ErrModelAccessibleFieldsRequired model accessible fields required
|
|
|
|
ErrModelAccessibleFieldsRequired = errors.New("model accessible fields required")
|
2023-02-27 10:43:10 +03:00
|
|
|
// ErrSubQueryRequired sub query required
|
|
|
|
ErrSubQueryRequired = errors.New("sub query required")
|
2020-08-18 13:00:36 +03:00
|
|
|
// ErrInvalidData unsupported data
|
|
|
|
ErrInvalidData = errors.New("unsupported data")
|
2020-06-19 13:30:04 +03:00
|
|
|
// ErrUnsupportedDriver unsupported driver
|
|
|
|
ErrUnsupportedDriver = errors.New("unsupported driver")
|
2020-06-23 04:38:51 +03:00
|
|
|
// ErrRegistered registered
|
|
|
|
ErrRegistered = errors.New("registered")
|
2020-06-30 11:53:54 +03:00
|
|
|
// ErrInvalidField invalid field
|
|
|
|
ErrInvalidField = errors.New("invalid field")
|
2020-09-03 06:32:30 +03:00
|
|
|
// ErrEmptySlice empty slice found
|
|
|
|
ErrEmptySlice = errors.New("empty slice found")
|
2020-09-18 16:34:44 +03:00
|
|
|
// ErrDryRunModeUnsupported dry run mode unsupported
|
|
|
|
ErrDryRunModeUnsupported = errors.New("dry run mode unsupported")
|
2021-04-19 16:03:39 +03:00
|
|
|
// ErrInvalidDB invalid db
|
|
|
|
ErrInvalidDB = errors.New("invalid db")
|
2021-03-07 05:56:32 +03:00
|
|
|
// ErrInvalidValue invalid value
|
2021-04-19 16:32:32 +03:00
|
|
|
ErrInvalidValue = errors.New("invalid value, should be pointer to struct or slice")
|
2021-03-07 05:56:32 +03:00
|
|
|
// ErrInvalidValueOfLength invalid values do not match length
|
|
|
|
ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match")
|
2022-01-30 13:17:06 +03:00
|
|
|
// ErrPreloadNotAllowed preload is not allowed when count is used
|
|
|
|
ErrPreloadNotAllowed = errors.New("preload is not allowed when count is used")
|
2023-03-06 09:03:31 +03:00
|
|
|
// ErrDuplicatedKey occurs when there is a unique key constraint violation
|
|
|
|
ErrDuplicatedKey = errors.New("duplicated key not allowed")
|
2023-05-21 16:27:22 +03:00
|
|
|
// ErrForeignKeyViolated occurs when there is a foreign key constraint violation
|
|
|
|
ErrForeignKeyViolated = errors.New("violates foreign key constraint")
|
2024-04-26 05:53:17 +03:00
|
|
|
// ErrCheckConstraintViolated occurs when there is a check constraint violation
|
|
|
|
ErrCheckConstraintViolated = errors.New("violates check constraint")
|
2020-01-30 10:14:48 +03:00
|
|
|
)
|