base

package
v0.0.0-...-af4dbcf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

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 GetCodeI

func GetCodeI(err error) CodeErrI

func NewCodeErr

func NewCodeErr(code uint, msg string) CodeErrI

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"`
}

type ResultRsp

type ResultRsp struct {
	Data any    `json:"data"`
	Msg  string `json:"msg"`
	Code int    `json:"code"`
}

响应结构体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL