req

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 16 Imported by: 13

Documentation

Index

Constants

View Source
const MaxQueryLimit = 5000

Variables

This section is empty.

Functions

func AddClient

func AddClient(id string, caCert string, clientCert string, clientKey string)

func BindParamsFromBody

func BindParamsFromBody(c *gin.Context, obj any) (err error)

func BindParamsFromQuery

func BindParamsFromQuery(c *gin.Context, obj any) (err error)

func DoDelete added in v1.2.0

func DoDelete(client *http.Client, url string, output any, token string) error

func DoGet

func DoGet(client *http.Client, url string, output any, token string) error

func DoPost added in v1.2.0

func DoPost(client *http.Client, url string, params any, output any, token string) error

func DoPut

func DoPut(client *http.Client, url string, params any, output any, token string) error

func GetClient

func GetClient(id string) *http.Client

func GetIdFromUrl

func GetIdFromUrl(c *gin.Context) (uint, error)

func GetPagingParams

func GetPagingParams(c *gin.Context) (offset int, limit int, errV error)

func GetParamAsBool added in v1.6.0

func GetParamAsBool(c *gin.Context, name string, defValue bool) (bool, error)

func GetParamAsInt added in v1.6.0

func GetParamAsInt(c *gin.Context, name string, defValue int) (int, error)

func NewBadRequestError added in v1.6.0

func NewBadRequestError(message string, params ...any) error

func NewForbiddenError added in v1.6.0

func NewForbiddenError(message string, params ...any) error

func NewNotFoundError added in v1.6.0

func NewNotFoundError(message string, params ...any) error

func NewServerError

func NewServerError(message string, params ...any) error

func NewServerErrorByError

func NewServerErrorByError(err error) error

func ReturnError

func ReturnError(c *gin.Context, err error)

func ReturnForbiddenError added in v1.1.0

func ReturnForbiddenError(c *gin.Context, message string)

func ReturnList

func ReturnList(c *gin.Context, result any, offset int, limit int, size int) error

func ReturnUnauthorizedError

func ReturnUnauthorizedError(c *gin.Context, message string)

Types

type AppError

type AppError struct {
	Code    int
	Message string
}

func (AppError) Error

func (e AppError) Error() string

Jump to

Keyboard shortcuts

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