Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CodeErrOK = NewCodeErr(0, "success") CodeErrSystem = NewCodeErr(1, "系统出错") CodeErrParamsInvalid = NewCodeErr(2, "参数无效") CodeErrNotFound = NewCodeErr(3, "404 not found") )
预留错误码,建议业务逻辑错误码从100开始,1-99给框架预留
Functions ¶
This section is empty.
Types ¶
type CodeErrI ¶
type CodeErrI interface { GetMsg() string FormatMsg(...any) CodeErrI GetCode() uint IsSuccess() bool error }
func NewCodeErr ¶
type CodeErrImpl ¶
type CodeErrImpl struct { Data any `json:"data"` Msg string `json:"msg"` FMsg string `json:"-"` Code uint `json:"code"` // contains filtered or unexported fields }
func (*CodeErrImpl) Error ¶
func (ce *CodeErrImpl) Error() string
func (*CodeErrImpl) FormatMsg ¶
func (ce *CodeErrImpl) FormatMsg(args ...any) CodeErrI
func (*CodeErrImpl) GetCode ¶
func (ce *CodeErrImpl) GetCode() uint
func (*CodeErrImpl) GetMsg ¶
func (ce *CodeErrImpl) GetMsg() string
func (*CodeErrImpl) IsSuccess ¶
func (ce *CodeErrImpl) IsSuccess() bool
type Model ¶
type Model struct { ID int `gorm:"type:int(10) AUTO_INCREMENT;primaryKey;autoIncrement;autoIncrementIncrement:1" json:"id"` CreatedAt int64 `gorm:"type:int(10);autoCreateTime" json:"created_at"` UpdatedAt int64 `gorm:"type:int(10);autoUpdateTime" json:"updated_at"` DeletedAt int64 `gorm:"type:int(10);index" json:"deleted_at"` }
Click to show internal directories.
Click to hide internal directories.