Documentation ¶
Index ¶
- Constants
- func CheckCountryZone(country, zone string, en_country, en_zone, dis_country, dis_zone *[]string) bool
- func CheckRecover()
- func GetErrorMessage(code uint32, message string) string
- func GetGID() uint64
- func GetLocalIP() (ip string, err error)
- func GetOutboundIP() string
- func GetRandomByte(n int) []byte
- func GetRandomStr(n int) string
- func IfOr[R any](flag bool, a, b R) R
- func IsNull(i interface{}) bool
- func MapToJson(hashmap interface{}) string
- func RecoverTraceCode()
- func StrVal(value interface{}) string
- func StructAssign(binding interface{}, value interface{})
- func TraceCode(code ...interface{})
- type JsonResult
Constants ¶
const ( OK = 200 // Success NotLoggedIn = 1000 // 未登录 ParameterIllegal = 1001 // 参数不合法 ServerError = 1004 // 系统错误 NotData = 1005 // 没有数据 ModelAddError = 1006 // 添加错误 ModelDeleteError = 1007 // 删除错误 ModelStoreError = 1008 // 存储错误 OperationFailure = 1009 // 操作失败 RoutingNotExist = 1010 // 路由不存在 )
Variables ¶
This section is empty.
Functions ¶
func CheckCountryZone ¶
func CheckRecover ¶
func CheckRecover()
* * @Description: 检测 recover并打印错误 stack * @Date: 2022-02-19 10:33:49 *
func GetGID ¶
func GetGID() uint64
* * @Description: 获取当前协程id * @return: uint64 * @Author: Iori * @Date: 2022-02-19 10:32:39 *
func GetLocalIP ¶
* * @Description: 获取本地ip地址 * @return: ip * @return: err *
func GetOutboundIP ¶
func GetOutboundIP() string
* * @Description: 获取外网ip地址 * @return: string * @Author: Iori *
func GetRandomByte ¶
* * @Description: * @param: n * @return: string * @Author: Iori * @Date: 2022-06-01 16:41:37 *
func GetRandomStr ¶
* * @Description: 随机指定长度字符串 * @param: n * @return: string * @Author: Iori * @Date: 2022-06-01 15:19:58 *
func IfOr ¶
* * @Description: 三目运算之泛型 * @param: flag * @param: a * @param: b * @return: R * @Author: Iori *
func IsNull ¶
func IsNull(i interface{}) bool
* * @Description: 是否為null值 ,default * @param: i * @return: bool * @Author: Iori *
func MapToJson ¶
func MapToJson(hashmap interface{}) string
* * @Description: * @param: hashmap * @return: string * @Author: Iori *
func RecoverTraceCode ¶
func RecoverTraceCode()
* * @Description: 检测 recover并跟踪代码 * @Date: 2022-02-26 18:00:12 *
func StrVal ¶
func StrVal(value interface{}) string
* * @Description: Strval 获取变量的字符串值,,浮点型 3.0将会转换成字符串3, "3",,非数值或字符类型的变量将会被转换成JSON格式字符串 * @param: value * @return: string *
func StructAssign ¶
func StructAssign(binding interface{}, value interface{})
* * @Description: 结构体数据复制 * @param: binding 要修改的结构体 * @param: value 有数据的结构体 * @Author: Iori * @Date: 2022-02-19 10:32:57 *
Types ¶
type JsonResult ¶
type JsonResult struct { Code uint32 `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
func Response ¶
func Response(code uint32, message string, data interface{}) JsonResult