Documentation
¶
Index ¶
- Constants
- func Bind(ctx *gin.Context, req interface{}) (err *errors.Error)
- func BindParams(ctx *gin.Context, req interface{}, noPrint ...bool) (err *errors.Error)
- func GetClientIP(ctx *gin.Context) string
- func GetPageReq(ctx *gin.Context) (pageReq *load.Page, err *errors.Error)
- func GetParam(ctx *gin.Context, key string, defValue ...string) (value interface{}, err *errors.Error)
- func GetParamArray[t any](ctx *gin.Context, key string, force Forcible, defValue ...[]t) (value []t, err *errors.Error)
- func GetParamBool(ctx *gin.Context, key string, force Forcible, defValue ...bool) (value bool, err *errors.Error)
- func GetParamFloat64(ctx *gin.Context, key string, force Forcible, defValue ...float64) (value float64, err *errors.Error)
- func GetParamForce(ctx *gin.Context, key string) (value string, err *errors.Error)
- func GetParamInt(ctx *gin.Context, key string, force Forcible, defValue ...int) (value int, err *errors.Error)
- func GetParamInt64(ctx *gin.Context, key string, force Forcible, defValue ...int64) (value int64, err *errors.Error)
- func GetParamInt64Slice(ctx *gin.Context, key string, force Forcible, defValue ...[]int64) (value []int64, err *errors.Error)
- func GetParamStr(ctx *gin.Context, key string, defValue ...string) (value string, err *errors.Error)
- func GetParamType[t ParamType](ctx *gin.Context, key string, force Forcible, defValue ...t) (value t, err *errors.Error)
- func GetParams(ctx *gin.Context, requestType ...RequestType) map[string]interface{}
- func GetTraceID(ctx *gin.Context) string
- func GetUserID(ctx *gin.Context) 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 Handle(ctx *gin.Context, code int, err *errors.Error)
- func HandleData(ctx *gin.Context, code int, data interface{}, err *errors.Error)
- func HandleError(ctx *gin.Context, code int, data *interface{}, error *errors.Error)
- func HandlePanic(ctx *gin.Context)
- func NewCtx() *gin.Context
- func PanicNotify(ctx *gin.Context, err interface{})
- func PutParams(ctx *gin.Context, params map[string]interface{})
- func SendError(ctx *gin.Context, code int, message string, error *errors.Error)
- func SetTraceID(ctx *gin.Context)
- func SetUserID(ctx *gin.Context, userID string)
- func SetUserInfo(ctx *gin.Context, userInfo map[string]interface{})
- type Forcible
- type ParamType
- type RequestType
Constants ¶
View Source
const (
ErrorKey = "error_g"
)
Variables ¶
This section is empty.
Functions ¶
func BindParams ¶
func GetClientIP ¶ added in v0.0.43
func GetParamArray ¶
func GetParamArray[t any](ctx *gin.Context, key string, force Forcible, defValue ...[]t) (value []t, err *errors.Error)
Recommended Use of URLSearchParams for Array Parameter Queries
func GetParamBool ¶
func GetParamFloat64 ¶
func GetParamForce ¶
func GetParamInt ¶
func GetParamInt64 ¶
func GetParamInt64Slice ¶
func GetParamStr ¶
func GetParamType ¶
func GetParams ¶
func GetParams(ctx *gin.Context, requestType ...RequestType) map[string]interface{}
func GetTraceID ¶ added in v0.0.43
func GetUserIDInt ¶ added in v0.0.43
func GetUserIDInt64 ¶ added in v0.0.43
func GetUserInfo ¶ added in v0.0.43
func HandleError ¶
func HandlePanic ¶
func PanicNotify ¶ added in v0.0.43
func SetTraceID ¶ added in v0.0.43
func SetUserInfo ¶ added in v0.0.43
Types ¶
type Forcible ¶
type Forcible bool
Forcible The force parameter will decide to return a parameter check error if the value is not found.
type RequestType ¶
type RequestType string
const ( Get RequestType = "Get" PostForm RequestType = "PostForm" PostBody RequestType = "PostBody" )
Click to show internal directories.
Click to hide internal directories.