parser

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidMultipart = errors.New("request has not multipart content type")
	ErrorOpenFile         = errors.New("file cannot be opened")
	ErrorReadData         = errors.New("cannot read data")
	ErrorPointerTarget    = errors.New("target must be a pointer")
	ErrorQueryMissing     = errors.New("query param is missing")
	ErrorPathValueMissing = errors.New("path value is missing")
)

Functions

This section is empty.

Types

type Parse

type Parse interface {
	Query(key string, target any) error
	PathValue(key string, target any) error
	File(filename string) (form.Multipart, error)
	Files(filesnames ...string) ([]form.Multipart, error)
	Json(target any) error
	Text() (string, error)
	Xml(target any) error
	Url(target any) error

	MustQuery(key string, target any)
	MustPathValue(key string, target any)
	MustFile(filename string) form.Multipart
	MustFiles(filesnames ...string) []form.Multipart
	MustJson(target any)
	MustText() string
	MustXml(target any)
	MustUrl(target any)
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func New

func New(r *http.Request, limit int64) *Parser

func (*Parser) File

func (p *Parser) File(filename string) (form.Multipart, error)

func (*Parser) Files

func (p *Parser) Files(filesname ...string) ([]form.Multipart, error)

func (*Parser) Json

func (p *Parser) Json(target any) error

func (*Parser) MustFile

func (p *Parser) MustFile(filename string) form.Multipart

func (*Parser) MustFiles

func (p *Parser) MustFiles(filesnames ...string) []form.Multipart

func (*Parser) MustJson

func (p *Parser) MustJson(target any)

func (*Parser) MustPathValue

func (p *Parser) MustPathValue(key string, target any)

func (*Parser) MustQuery

func (p *Parser) MustQuery(key string, target any)

func (*Parser) MustText

func (p *Parser) MustText() string

func (*Parser) MustUrl

func (p *Parser) MustUrl(target any)

func (*Parser) MustXml

func (p *Parser) MustXml(target any)

func (*Parser) PathValue

func (p *Parser) PathValue(key string, target any) error

func (*Parser) Query

func (p *Parser) Query(key string, target any) error

func (*Parser) Text

func (p *Parser) Text() (string, error)

func (*Parser) Url

func (p *Parser) Url(target any) error

func (*Parser) Xml

func (p *Parser) Xml(value any) error

Jump to

Keyboard shortcuts

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