ginx

package
v0.0.0-...-86cf879 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqBodyKey = prefix + "/req-body"
	ResBodyKey = prefix + "/res-body"
)

Variables

This section is empty.

Functions

func GetBodyData

func GetBodyData(c *gin.Context) []byte

Get body data from context

func GetToken

func GetToken(c *gin.Context) string

Get jwt token from header (Authorization: Bearer xxx)

func ParseForm

func ParseForm(c *gin.Context, obj interface{}) error

Parse body form data to struct

func ParseJSON

func ParseJSON(c *gin.Context, obj interface{}) error

Parse body json data to struct

func ParseParamID

func ParseParamID(c *gin.Context, key string) uint64

Param returns the value of the URL param

func ParseQuery

func ParseQuery(c *gin.Context, obj interface{}) error

Parse query parameter to struct

func ResError

func ResError(c *gin.Context, err error, status ...int)

Response error object and parse error status code

func ResJSON

func ResJSON(c *gin.Context, status int, v interface{})

Response json data with status code

func ResList

func ResList(c *gin.Context, v interface{})

Response data with list object

func ResOK

func ResOK(c *gin.Context)

Response success with status ok

func ResPage

func ResPage(c *gin.Context, v interface{}, pr *schema.PaginationResult)

Response pagination data object

func ResSuccess

func ResSuccess(c *gin.Context, v interface{})

Response data object

Types

This section is empty.

Jump to

Keyboard shortcuts

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