Documentation ¶
Index ¶
- func Is(src, dst error) bool
- func NewError(db *gorm.DB, ori error, text string) error
- type Column
- type Error
- type ErrorPlugin
- func (ep *ErrorPlugin) DuplicatedKey(db *gorm.DB, err *mysql.MySQLError) error
- func (ep *ErrorPlugin) ForeignKey(db *gorm.DB, err *mysql.MySQLError, isCreate bool) error
- func (ep *ErrorPlugin) Initialize(db *gorm.DB) error
- func (ep *ErrorPlugin) Name() string
- func (ep *ErrorPlugin) Register(object TableComment)
- func (ep *ErrorPlugin) Transform(db *gorm.DB)
- type ForeignError
- type GormError
- type GormErrorPlugin
- type Info
- type Option
- type TableComment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorPlugin ¶
type ErrorPlugin struct {
// contains filtered or unexported fields
}
func (*ErrorPlugin) DuplicatedKey ¶
func (ep *ErrorPlugin) DuplicatedKey(db *gorm.DB, err *mysql.MySQLError) error
DuplicatedKey 处理唯一索引错误
func (*ErrorPlugin) ForeignKey ¶
func (ep *ErrorPlugin) ForeignKey(db *gorm.DB, err *mysql.MySQLError, isCreate bool) error
ForeignKey 处理创建引用错误
func (*ErrorPlugin) Initialize ¶
func (ep *ErrorPlugin) Initialize(db *gorm.DB) error
func (*ErrorPlugin) Name ¶
func (ep *ErrorPlugin) Name() string
func (*ErrorPlugin) Transform ¶
func (ep *ErrorPlugin) Transform(db *gorm.DB)
type ForeignError ¶
type GormErrorPlugin ¶
type GormErrorPlugin interface { Name() string Initialize(*gorm.DB) error Register(object TableComment) // contains filtered or unexported methods }
func NewGlobalGormErrorPlugin ¶
func NewGlobalGormErrorPlugin(opts ...Option) GormErrorPlugin
func NewGormErrorPlugin ¶
func NewGormErrorPlugin(opts ...Option) GormErrorPlugin
type Option ¶
type Option func(o *options)
func WithAddForeignKeyFormat ¶
func WithDelForeignKeyFormat ¶
func WithDuplicatedKeyFormat ¶
func WithEnableLoad ¶
func WithEnableLoad() Option
type TableComment ¶
type TableComment interface {
Comment() string
}
Click to show internal directories.
Click to hide internal directories.