web

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestBodyKey  = "request-body"
	ResponseBodyKey = "response-body"

	Success = "0"
)

Variables

This section is empty.

Functions

func GetBodyData

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

func GetToken

func GetToken(c *gin.Context) string

func ParseForm

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

func ParseJSON

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

func ParseQuery

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

func ResError

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

func ResJson

func ResJson(c *gin.Context, status int, v any)

func ResOk

func ResOk(c *gin.Context)

func ResPage

func ResPage(c *gin.Context, pr *PageResult)

func ResSuccess

func ResSuccess(c *gin.Context, v any)

Types

type PageResult

type PageResult struct {
	Items any   `json:"items"`
	Total int64 `json:"total"`
}

func FromPaginationResult

func FromPaginationResult(pr *dbx.PaginationResult) *PageResult

type ResponseResult

type ResponseResult struct {
	Code    string `json:"code"`
	Data    any    `json:"data,omitempty"`
	Message string `json:"message,omitempty"`
}

func NewResponseResult

func NewResponseResult(code string, message string, data any) ResponseResult

Jump to

Keyboard shortcuts

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