Documentation
¶
Index ¶
- Constants
- func CORS() gin.HandlerFunc
- func DebouceAw(path ...string)
- func Debounce(duration time.Duration) gin.HandlerFunc
- func DebounceDisable()
- func DumpRouters(call func(info gin.RouteInfo))
- func Fail(ctx *gin.Context, err *errors.Error)
- func Get(baseURL string, params map[string]string) (resp string, err *errors.Error)
- func GetByCtx(ctx *gin.Context, baseURL string, params map[string]interface{}) (map[string]interface{}, *errors.Error)
- func GetClientIP(ctx *gin.Context) string
- func GetHeader(baseURL string, params map[string]string, header map[string]string) (resp string, err *errors.Error)
- func GetMap(baseURL string, params map[string]string) (map[string]interface{}, *errors.Error)
- func GetMapHeader(baseURL string, params map[string]string, header map[string]string) (map[string]interface{}, *errors.Error)
- func GetToken(c *gin.Context) string
- func GetTokenByCtx(c *gin.Context, mustExit bool) string
- func GetTraceID(ctx *gin.Context) string
- func GetUserID(ctx *gin.Context) string
- func GetUserIDByToken(token string) (userID string)
- func GetUserIDInt(ctx *gin.Context) int
- func GetUserIDInt64(ctx *gin.Context) int64
- func GetUserInfo(ctx *gin.Context) map[string]interface{}
- func GetUserInfoValue(ctx *gin.Context, key string) any
- func Logger() gin.HandlerFunc
- func NewCtx() *gin.Context
- func ParseJSON(jsonStr string) map[string]interface{}
- func ParseXML[T any](xmlStr string) (*T, *errors.Error)
- func PostForm(baseURL string, params map[string]string) (resp string, err *errors.Error)
- func PostJSON(baseURL string, params interface{}) (map[string]interface{}, *errors.Error)
- func PostJSONByCtx(ctx *gin.Context, baseURL string, params interface{}) (map[string]interface{}, *errors.Error)
- func PostJSONHeader(baseURL string, params interface{}, header map[string]string) (map[string]interface{}, *errors.Error)
- func PostJSONResp(baseURL string, params interface{}) (resp string, err *errors.Error)
- func PostJSONRespHeader(baseURL string, params interface{}, header map[string]string) (resp string, err *errors.Error)
- func PostXML(baseURL string, params map[string]string) (resp string, err *errors.Error)
- func RegisterRouter(reg func(groupRouter *gin.RouterGroup))
- func RegisterRouterMid(...) *gin.RouterGroup
- func SetTraceID(ctx *gin.Context)
- func SetUserID(ctx *gin.Context, userID string)
- func SetUserInfo(ctx *gin.Context, userInfo map[string]interface{})
- func Shutdown(code string, ctx context.Context) error
- func SignDef() gin.HandlerFunc
- func SignRedis() gin.HandlerFunc
- func SignUserDef(userFilter map[string]interface{}) gin.HandlerFunc
- func SignUserRedis(userFilter map[string]interface{}) gin.HandlerFunc
- func Startup(code, port string) error
- func Success(ctx *gin.Context, data any)
- type HeaderParams
- type ShardedRequestMap
Constants ¶
View Source
const ( AllowMethods = "GET, POST, PUT, DELETE, OPTIONS" AllowHeaders = "" + "Origin, " + "Content-Type, " + "Content-Length, " + "Accept-Encoding, " + "X-CSRF-Token, " + "Authorization, " )
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
func CORS() gin.HandlerFunc
func DebounceDisable ¶
func DebounceDisable()
func DumpRouters ¶
func GetClientIP ¶
func GetMapHeader ¶
func GetTraceID ¶
func GetUserIDByToken ¶
func GetUserIDInt ¶
func GetUserIDInt64 ¶
func GetUserInfo ¶
func Logger ¶
func Logger() gin.HandlerFunc
func PostJSONByCtx ¶
func PostJSONHeader ¶
func PostJSONResp ¶
func PostJSONRespHeader ¶
func RegisterRouter ¶
func RegisterRouter(reg func(groupRouter *gin.RouterGroup))
RegisterRouter 注册路由
func RegisterRouterMid ¶
func RegisterRouterMid(group func(groupRouter *gin.RouterGroup, mid ...gin.HandlerFunc) *gin.RouterGroup, mid ...gin.HandlerFunc) *gin.RouterGroup
func SetTraceID ¶
func SetUserInfo ¶
func SignRedis ¶
func SignRedis() gin.HandlerFunc
func SignUserDef ¶
func SignUserDef(userFilter map[string]interface{}) gin.HandlerFunc
SignUserDef 校验token并校验用户 map用于校验用户信息是否符合要求
func SignUserRedis ¶
func SignUserRedis(userFilter map[string]interface{}) gin.HandlerFunc
Types ¶
type HeaderParams ¶
type HeaderParams struct {
Authorization string `header:"Authorization" binding:"required,min=20"`
}
type ShardedRequestMap ¶
type ShardedRequestMap struct {
// contains filtered or unexported fields
}
func NewShardedRequestMap ¶
func NewShardedRequestMap() *ShardedRequestMap
Click to show internal directories.
Click to hide internal directories.