request

package
v2.2.9 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Bind

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

func BindJSON

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

func BindJSONValue

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

func BindQuery

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

func BindUri

func BindUri[T any](c *gin.Context) (*T, 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 map[string]string
	Where   *clause.ExpressionWhere
}

func Filter

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

type IdRequest

type IdRequest struct {
	Id int `uri:"id" binding:"required"`
}

type MetaRequest

type MetaRequest struct {
	*PaginationRequest
	*FilterRequest
}

func Meta

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

type MultipleCreateRequest added in v2.1.12

type MultipleCreateRequest[T any] struct {
	Data []T `json:"data" binding:"required,min=1,max=100"`
}

type MultipleDeleteRequest added in v2.1.12

type MultipleDeleteRequest struct {
	Data []int `json:"data" binding:"required,min=1,max=100"`
}

type MultipleUpdateRequest added in v2.1.12

type MultipleUpdateRequest[T any] struct {
	Data []T `json:"data" binding:"required,min=1,max=100"`
}

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