Documentation ¶
Index ¶
- Constants
- Variables
- func ErrMsg(code int) string
- type MessageError
- type Model
- type Page
- func (p *Page) Bean(bean interface{}) *Page
- func (p *Page) Bind(records interface{}, bean interface{}) *Page
- func (p *Page) Columns(columns ...string)
- func (p *Page) GetBean() interface{}
- func (p *Page) GetColumns() string
- func (p *Page) GetCurrent() uint32
- func (p *Page) GetSize() uint32
- func (p *Page) Offset() uint32
- func (p *Page) SetTotal(total int64)
- type Result
- type ResultError
Constants ¶
Variables ¶
View Source
var ( SuccessResult = NewResultError(200, "success") BizErrResult = NewResultError(400, "biz error") MethodNotAllowResult = NewResultError(405, "method not allow") NotFoundResult = NewResultError(404, "not found") ServerErrorResult = NewResultError(500, "server error") )
View Source
var ( ErrorCode = map[int]string{ SuccessCode: SuccessMsg, } )
Functions ¶
Types ¶
type MessageError ¶
type MessageError struct {
// contains filtered or unexported fields
}
MessageError 自定义消息错误
func New ¶
func New(code int) *MessageError
func NewMessageError ¶
func NewMessageError(parent error, code int) *MessageError
func NewSecondMsg ¶
func NewSecondMsg(parent error, code int, msg string) *MessageError
func (*MessageError) Code ¶
func (m *MessageError) Code() int
func (*MessageError) Error ¶
func (m *MessageError) Error() string
func (*MessageError) Parent ¶
func (m *MessageError) Parent() error
func (*MessageError) SecondMsg ¶
func (m *MessageError) SecondMsg() string
type Model ¶
type Model struct { Id int `json:"id" gorm:"column:id; AUTO_INCREMENT;"` CreatedAt *time.Time `json:"createdAt" gorm:"column:created_at;type:datetime;not null;default:current_timestamp;comment:创建时间"` CreatedBy int `json:"createdBy" gorm:"column:created_by;type:int; unsigned;not null;default:0"` UpdatedAt *time.Time `` /* 126-byte string literal not displayed */ UpdatedBy int `json:"updatedBy" gorm:"column:updated_by;type:int; unsigned;not null;default:0"` }
type Page ¶
type Page struct { Total int64 `json:"total"` Current uint32 `json:"current"` Size uint32 `json:"size"` Records interface{} `json:"records"` Desc []string `json:"desc"` Asc []string `json:"asc"` // contains filtered or unexported fields }
func NewPageSort ¶
func (*Page) GetColumns ¶
func (*Page) GetCurrent ¶
type Result ¶
type Result struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
Result 统一返回结果
func ResError ¶
func ResError(bizerr ResultError) *Result
func ServerError ¶
func ServerError() *Result
type ResultError ¶
type ResultError struct {
// contains filtered or unexported fields
}
func NewResultError ¶
func NewResultError(code int, msg string) ResultError
NewResultError 创建业务逻辑错误结构体,默认为业务逻辑错误
func (ResultError) Code ¶
func (e ResultError) Code() int
func (ResultError) Error ¶
func (e ResultError) Error() string
Click to show internal directories.
Click to hide internal directories.