ginplus

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// UserIDKey - Key in the storage context (user ID)
	UserIDKey = prefix + "/user-id"
	// UserUUIDKey - Key in the storage context (user UUID)
	UserUUIDKey = prefix + "/user-uuid"
	// TraceIDKey - Key in storage context (tracking ID)
	TraceIDKey = prefix + "/trace-id"
	// ResBodyKey - The key in the storage context (response to the Body data)
	ResBodyKey = prefix + "/res-body"
)

Define the keys in the context

Variables

This section is empty.

Functions

func GetPageIndex

func GetPageIndex(c *gin.Context) int

GetPageIndex - Get paged page index

func GetPageSize

func GetPageSize(c *gin.Context) int

GetPageSize - Get the page size of the page (up to 50)

func GetPaginationParam

func GetPaginationParam(c *gin.Context) *schema.PaginationParam

GetPaginationParam - Get paging query parameters

func GetToken

func GetToken(c *gin.Context) string

GetToken - Get user token

func GetTraceID

func GetTraceID(c *gin.Context) string

GetTraceID - Get tracking ID

func GetUserID

func GetUserID(c *gin.Context) int

GetUserID - Get user ID

func GetUserUUID

func GetUserUUID(c *gin.Context) string

GetUserUUID - Get user UUID

func NewContext

func NewContext(c *gin.Context) context.Context

NewContext - Package context entry

func ParseJSON

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

ParseJSON - Parse request JSON

func ResError

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

ResError - Response error

func ResJSON

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

ResJSON - Respond to JSON data

func ResList

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

ResList - Response list data

func ResOK

func ResOK(c *gin.Context)

ResOK - Respond OK

func ResPage

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

ResPage - Response paging data

func ResSuccess

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

ResSuccess - Successful response

func SetUserID

func SetUserID(c *gin.Context, userID int)

SetUserID - Set user ID

func SetUserUUID

func SetUserUUID(c *gin.Context, userUUID string)

SetUserUUID - Set user UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

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