Documentation ¶
Index ¶
- Constants
- Variables
- func ComLogNotice(c *gin.Context, srtag string, m map[string]interface{})
- func ComLogWarning(c *gin.Context, srtag string, m map[string]interface{})
- func ContextError(c context.Context, srtag string, m map[string]interface{})
- func ContextNotice(c context.Context, srtag string, m map[string]interface{})
- func ContextWarning(c context.Context, srtag string, m map[string]interface{})
- func DefaultGetValidParams(c *gin.Context, params interface{}) error
- func GenToken(user Users) (string, error)
- func GetGinTraceContext(c *gin.Context) *lib.TraceContext
- func GetTraceContext(c context.Context) *lib.TraceContext
- func GetTranslation(c *gin.Context) (ut.Translator, error)
- func GetValidator(c *gin.Context) (*validator.Validate, error)
- func RefreshToken(tokenStr string) (string, error)
- type CustomClaims
- type ResponseCode
- type Users
Constants ¶
View Source
const ( ValidatorKey = "ValidatorKey" TranslatorKey = "TranslatorKey" )
Variables ¶
View Source
var MySecret = []byte("otto_lzn")
Functions ¶
func ComLogNotice ¶
ComLogNotice 普通日志
func ComLogWarning ¶
ComLogWarning 错误日志
func ContextError ¶
ContextError 错误日志
func ContextNotice ¶
ContextNotice 普通日志
func ContextWarning ¶
ContextWarning 错误日志
func DefaultGetValidParams ¶
DefaultGetValidParams 默认验证器
func GetGinTraceContext ¶
func GetGinTraceContext(c *gin.Context) *lib.TraceContext
GetGinTraceContext 从gin的Context中获取数据
func GetTraceContext ¶
func GetTraceContext(c context.Context) *lib.TraceContext
GetTraceContext 从Context中获取数据
func GetTranslation ¶
func GetTranslation(c *gin.Context) (ut.Translator, error)
func GetValidator ¶
Types ¶
type CustomClaims ¶
type CustomClaims struct { Users jwt.StandardClaims }
type ResponseCode ¶
type ResponseCode int
const ( SuccessCode ResponseCode = iota UndefErrorCode ValidErrorCode InternalErrorCode InvalidRequestErrorCode ResponseCode = 401 CustomizeCode ResponseCode = 1000 GroupAllSaveFlowError ResponseCode = 2001 OtherErrorCode ResponseCode = -1 )
1000以下为通用码,1000以上为用户自定义码
Click to show internal directories.
Click to hide internal directories.