request

package
v2.3.38 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Bind

func Bind[T any](c *gin.Context) (*T, error)

func BindImportFileRequest added in v2.3.0

func BindImportFileRequest[T any](c *gin.Context) ([]T, map[string]string, error)

func BindJSON

func BindJSON[T any](c *gin.Context) (*T, error)

func BindJSONValue

func BindJSONValue(c *gin.Context, r interface{}) error

func BindJsonStruct added in v2.3.0

func BindJsonStruct(obj any) error

func BindQuery

func BindQuery[T any](c *gin.Context) (*T, error)

func BindUri

func BindUri[T any](c *gin.Context) (*T, error)

func DecodeJSON added in v2.3.0

func DecodeJSON(r io.Reader, obj any) error

func Id

func Id(c *gin.Context) (int, error)

func ParseWhere added in v2.1.9

func ParseWhere(input string) (*clause.ExpressionWhere, error)

func TxHandle

func TxHandle(c *gin.Context) *gorm.DB

func UUID

func UUID(c *gin.Context) (string, error)

Types

type FilterRequest

type FilterRequest struct {
	OrderBy []clause.ExpressionOrderBy
	Where   *clause.ExpressionWhere
}

func Filter

func Filter(c *gin.Context) (*FilterRequest, error)

func FilterJSON added in v2.3.0

func FilterJSON(c *gin.Context) (*FilterRequest, error)

type IdRequest

type IdRequest struct {
	Id int `uri:"id" binding:"required,gte=1"`
}

type ImportRequest added in v2.3.0

type ImportRequest struct {
	CSV *multipart.FileHeader `form:"csv" binding:"required"`
}

type MetaRequest

type MetaRequest struct {
	*PaginationRequest
	*FilterRequest
}

func Meta

func Meta(c *gin.Context) (*MetaRequest, error)

type MultipleDeleteRequest added in v2.1.12

type MultipleDeleteRequest struct {
	IDs []int `json:"ids" binding:"required,min=1,max=500000,unique"`
}

type MultipleUpdateRequest added in v2.1.12

type MultipleUpdateRequest[T any] struct {
	IDs  []int `json:"ids" binding:"required,min=1,max=500000,unique"`
	Data T     `json:"data" binding:"required"`
}

type PaginationRequest

type PaginationRequest struct {
	Limit               int  `form:"limit" binding:"omitempty"`
	Offset              int  `form:"offset" binding:"omitempty"`
	MustReturnTotalRows bool `form:"count" binding:"omitempty"`
}

func Pagination

func Pagination(c *gin.Context) (*PaginationRequest, error)

type UUIDRequest

type UUIDRequest struct {
	UUID string `uri:"uuid" binding:"required"`
}

Jump to

Keyboard shortcuts

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