apix

package
v0.0.52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 19 Imported by: 7

Documentation

Index

Constants

View Source
const (
	ErrorKey = "error_g"
)

Variables

This section is empty.

Functions

func Bind added in v0.0.38

func Bind(ctx *gin.Context, req interface{}) (err *errors.Error)

func BindParams

func BindParams(ctx *gin.Context, req interface{}, noPrint ...bool) (err *errors.Error)

func GetClientIP added in v0.0.43

func GetClientIP(ctx *gin.Context) string

func GetPageReq

func GetPageReq(ctx *gin.Context) (pageReq *load.Page, err *errors.Error)

func GetParam

func GetParam(ctx *gin.Context, key string, defValue ...string) (value interface{}, err *errors.Error)

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 GetParamBool(ctx *gin.Context, key string, force Forcible, defValue ...bool) (value bool, err *errors.Error)

func GetParamFloat64

func GetParamFloat64(ctx *gin.Context, key string, force Forcible, defValue ...float64) (value float64, err *errors.Error)

func GetParamForce

func GetParamForce(ctx *gin.Context, key string) (value string, err *errors.Error)

func GetParamInt

func GetParamInt(ctx *gin.Context, key string, force Forcible, defValue ...int) (value int, err *errors.Error)

func GetParamInt64

func GetParamInt64(ctx *gin.Context, key string, force Forcible, defValue ...int64) (value int64, err *errors.Error)

func GetParamInt64Slice

func GetParamInt64Slice(ctx *gin.Context, key string, force Forcible, defValue ...[]int64) (value []int64, err *errors.Error)

func GetParamStr

func GetParamStr(ctx *gin.Context, key string, defValue ...string) (value string, err *errors.Error)

func GetParamType

func GetParamType[t ParamType](ctx *gin.Context, key string, force Forcible, defValue ...t) (value t, err *errors.Error)

func GetParams

func GetParams(ctx *gin.Context, requestType ...RequestType) map[string]interface{}

func GetTraceID added in v0.0.43

func GetTraceID(ctx *gin.Context) string

func GetUserID added in v0.0.43

func GetUserID(ctx *gin.Context) string

func GetUserIDInt added in v0.0.43

func GetUserIDInt(ctx *gin.Context) int

func GetUserIDInt64 added in v0.0.43

func GetUserIDInt64(ctx *gin.Context) int64

func GetUserInfo added in v0.0.43

func GetUserInfo(ctx *gin.Context) map[string]interface{}

func GetUserInfoValue added in v0.0.43

func GetUserInfoValue(ctx *gin.Context, key string) any

func Handle

func Handle(ctx *gin.Context, code int, err *errors.Error)

func HandleData

func HandleData(ctx *gin.Context, code int, data interface{}, err *errors.Error)

func HandleError

func HandleError(ctx *gin.Context, code int, data *interface{}, error *errors.Error)

func HandlePanic

func HandlePanic(ctx *gin.Context)

func NewCtx added in v0.0.43

func NewCtx() *gin.Context

func PanicNotify added in v0.0.43

func PanicNotify(ctx *gin.Context, err interface{})

func PutParams

func PutParams(ctx *gin.Context, params map[string]interface{})

func SendError

func SendError(ctx *gin.Context, code int, message string, error *errors.Error)

func SetTraceID added in v0.0.43

func SetTraceID(ctx *gin.Context)

func SetUserID added in v0.0.43

func SetUserID(ctx *gin.Context, userID string)

func SetUserInfo added in v0.0.43

func SetUserInfo(ctx *gin.Context, userInfo map[string]interface{})

Types

type Forcible

type Forcible bool

Forcible The force parameter will decide to return a parameter check error if the value is not found.

const (
	Force    Forcible = true
	NotForce Forcible = false
)

type ParamType

type ParamType interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~string | ~bool | struct{}
}

type RequestType

type RequestType string
const (
	Get      RequestType = "Get"
	PostForm RequestType = "PostForm"
	PostBody RequestType = "PostBody"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL