Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptWithRSA(cipherText string, privateKeyPath string) (string, error)
- func ERR(ctx *gin.Context, v interface{})
- func EncryptWithRSA(plainText string, publicKeyPath string) (string, error)
- func GetToken(ctx *gin.Context) *jwt.CustomData
- func MWAuthentication() gin.HandlerFunc
- func MWCORS() gin.HandlerFunc
- func MWError() gin.HandlerFunc
- func OK(ctx *gin.Context, v interface{})
- func Paginate(offset int, limit int) func(db *gorm.DB) *gorm.DB
- func SystemERR(ctx *gin.Context, v interface{})
- func TenantIdSpace(ctx *gin.Context) func(db *gorm.DB) *gorm.DB
- func UserIdSpace(ctx *gin.Context) func(db *gorm.DB) *gorm.DB
- type CornTask
- type Err
- type ImplTask
- type JsonResult
- type Namespaces
- type PageResult
- type Process
- type ResultFunc
Constants ¶
View Source
const ( ERROR_COMMON = 1000 ERROR_PNR = 2000 )
View Source
const ( SUCCESS = 0 SUCCESS_MESSAGE = "success" ERROR_COMMON_OFFSET = ERROR_COMMON + 1 ERROR_COMMON_OFFSET_MESSAGE = "offset偏移量错误" ERROR_COMMON_LIMIT = ERROR_COMMON + 2 ERROR_COMMON_LIMIT_MESSAGE = "limit限制错误" ERROR_COMMON_IOUTIL_READALL = ERROR_COMMON + 3 ERROR_COMMON_IOUTIL_READALL_MESSAGE = "读取文件错误" ERROR_COMMON_UNMARSHAL = ERROR_COMMON + 4 ERROR_COMMON_UNMARSHAL_MESSAGE = "反序列化错误" ERROR_COMMON_GETLIST_COUNT = ERROR_COMMON + 5 ERROR_COMMON_GETLIST_COUNT_MESSAGE = "获取列表总数错误" ERROR_COMMON_GETLIST = ERROR_COMMON + 6 ERROR_COMMON_GETLIST_MESSAGE = "获取列表错误" ERROR_COMMON_DATABASE_GET = ERROR_COMMON + 7 ERROR_COMMON_DATABASE_GET_MESSAGE = "数据库查询错误" ERROR_COMMON_DATABASE_INSERT = ERROR_COMMON + 8 ERROR_COMMON_DATABASE_INSERT_MESSAGE = "数据库插入错误" ERROR_COMMON_DATABASE_UPDATE = ERROR_COMMON + 9 ERROR_COMMON_DATABASE_UPDATE_MESSAGE = "数据库更新错误" ERROR_COMMON_DATABASE_DELETE = ERROR_COMMON + 10 ERROR_COMMON_DATABASE_DELETE_MESSAGE = "数据库删除错误" ERROR_COMMON_ID_GET = ERROR_COMMON + 11 ERROR_COMMON_ID_GET_MESSAGE = "获取ID错误" ERROR_COMMON_PARAM_ID = ERROR_COMMON + 12 ERROR_COMMON_PARAM_ID_MESSAGE = "ID参数错误" ERROR_COMMON_TIME_FORMAT = ERROR_COMMON + 13 ERROR_COMMON_TIME_FORMAT_MESSAGE = "时间格式错误" ERROR_COMMON_BINDED = ERROR_COMMON + 14 ERROR_COMMON_BINDED_MESSAGE = "已绑定" ERROR_COMMON_UNAUTHORIZED = ERROR_COMMON + 15 ERROR_COMMON_UNAUTHORIZED_MESSAGE = "未授权" ERROR_COMMON_ENCRYPT = ERROR_COMMON + 16 ERROR_COMMON_ENCRYPT_MESSAGE = "加密错误" ERROR_COMMON_LOGIN = ERROR_COMMON + 17 ERROR_COMMON_LOGIN_MESSAGE = "登录错误" ERROR_COMMON_DUPLICATE = ERROR_COMMON + 18 ERROR_COMMON_DUPLICATE_MESSAGE = "数据重复" ERROR_COMMON_BAD_REQUEST = ERROR_COMMON + 19 ERROR_COMMON_BAD_REQUEST_MESSAGE = "错误的请求消息" ERROR_COMMON_FILE_SIZE = ERROR_COMMON + 20 ERROR_COMMON_FILE_SIZE_MESSAGE = "文件大小错误" ERROR_COMMON_FILE_READ = ERROR_COMMON + 21 ERROR_COMMON_FILE_READ_MESSAGE = "文件读取错误" ERROR_COMMON_FILE_IMPORT = ERROR_COMMON + 22 ERROR_COMMON_FILE_IMPORT_MESSAGE = "文件导入错误" ERROR_COMMON_PHONE_FORMAT = ERROR_COMMON + 23 ERROR_COMMON_PHONE_FORMAT_MESSAGE = "手机号格式错误" ERROR_COMMON_EMAIL_FORMAT = ERROR_COMMON + 24 ERROR_COMMON_EMAIL_FORMAT_MESSAGE = "邮箱格式错误" ERROR_COMMON_REQUEST_VERIFICATION = ERROR_COMMON + 25 ERROR_COMMON_REQUEST_VERIFICATION_MESSAGE = "请求参数验证失败" ERROR_COMMON_STSTEM_INTERNAL_FAULT = ERROR_COMMON + 26 ERROR_COMMON_STSTEM_INTERNAL_FAULT_MESSAGE = "系统内部故障" )
View Source
const ( ERROR_PNR_ROUTE_CALL = ERROR_PNR + 1 ERROR_PNR_ROUTE_CALL_MESSAGE = "路由调用失败" ERROR_PNR_COMET_CALL = ERROR_PNR + 2 ERROR_PNR_COMET_CALL_MESSAGE = "长连接调用失败" )
Variables ¶
View Source
var (
AuthFailedErr = &Err{ErrStr: "认证失败", ErrCode: ERROR_COMMON_UNAUTHORIZED}
)
Functions ¶
func DecryptWithRSA ¶
DecryptWithRSA rsa解密
func EncryptWithRSA ¶
EncryptWithRSA rsa加密
func MWAuthentication ¶
func MWAuthentication() gin.HandlerFunc
func MWCORS ¶
func MWCORS() gin.HandlerFunc
func TenantIdSpace ¶
TenantIdSpace 租户id隔离数据
Types ¶
type JsonResult ¶
type JsonResult struct { Code int `json:"code"` Data interface{} `json:"data"` Message interface{} `json:"message"` }
func NewJsonResult ¶
func NewJsonResult(code int, message interface{}, data interface{}) *JsonResult
type Namespaces ¶
Namespaces 数据隔离函数原型
type PageResult ¶
type PageResult struct { Code int `json:"code"` Data interface{} `json:"data"` Total int64 `json:"total"` Message interface{} `json:"message"` TotalPage int `json:"total_page"` }
func NewPageResult ¶
func NewPageResult(code int, total int64, totalPage int, data interface{}, messages ...string) *PageResult
type Process ¶ added in v0.0.8
type Process[T interface{}] struct {
// contains filtered or unexported fields
}
Process Err消化器(不要在意名字)
type ResultFunc ¶
type ResultFunc func(result interface{}) func(output output)
func Response ¶
func Response(ctx *gin.Context) ResultFunc
Click to show internal directories.
Click to hide internal directories.