request

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 437

Documentation

Index

Constants

View Source
const (
	// DefaultPageSize 默认分页大小
	DefaultPageSize = 20
	// DefaultPageNumber 默认页号
	DefaultPageNumber = 1
)

Variables

View Source
var (
	// BodyMaxContenxLength body最大大小 默认64M
	BodyMaxContenxLength int64 = 1 << 26
)

Functions

func GetDataFromRequest added in v0.1.2

func GetDataFromRequest(r *http.Request, v interface{}) error

GetDataFromRequest todo

func ReadBody added in v0.1.2

func ReadBody(r *http.Request) ([]byte, error)

ReadBody 读取Body当中的数据

Types

type PageRequest

type PageRequest struct {
	PageSize   uint `json:"page_size,omitempty" validate:"gte=1,lte=200"`
	PageNumber uint `json:"page_number,omitempty" validate:"gte=1"`
}

PageRequest 分页请求 request

func NewPageRequest added in v0.1.2

func NewPageRequest(ps uint, pn uint) *PageRequest

NewPageRequest 实例化

func NewPageRequestFromHTTP added in v0.1.2

func NewPageRequestFromHTTP(req *http.Request) *PageRequest

NewPageRequestFromHTTP 从HTTP请求中加载分页请求

func (*PageRequest) Offset

func (p *PageRequest) Offset() int64

Offset skip

Jump to

Keyboard shortcuts

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