request

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapFormToStruct

func MapFormToStruct(r *http.Request, dest interface{}) error

Types

type MappingError

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

func (*MappingError) Error

func (e *MappingError) Error() string

type RequestContext added in v0.1.8

type RequestContext interface {
	GetRequest() *http.Request
	GetWriter() http.ResponseWriter
	GetDI() serverdi.Context
	GetURI() *URI

	BindJSON(dest interface{}) error
	BindForm(dest interface{}) error

	JSON(status int, data interface{})
	String(status int, text string)
	Status(status int)

	Set(key string, value interface{})
	Get(key string) (interface{}, bool)
}

func NewContext added in v0.1.8

type URI added in v0.1.8

type URI struct {
	Path          string
	Query         url.Values
	PathVariables map[string]string
	// PathRemainder is populated by the router when the matched
	// route ends in a `**` catch-all segment. It holds everything in
	// the real URL after the literal prefix — e.g. for pattern
	// `/public/media/**` and URL `/public/media/owner/images/logo.png`
	// the remainder is `owner/images/logo.png`. Empty for normal
	// routes.
	PathRemainder string
}

func NewURI added in v0.1.8

func NewURI(r *http.Request) *URI

func (*URI) ExtractPathVariables added in v0.1.8

func (u *URI) ExtractPathVariables(pattern string)

func (*URI) GetAllPathVariables added in v0.1.8

func (u *URI) GetAllPathVariables() map[string]string

func (*URI) GetPath added in v0.1.8

func (u *URI) GetPath() string

func (*URI) GetPathRemainder added in v0.1.9

func (u *URI) GetPathRemainder() string

GetPathRemainder returns the catch-all remainder computed by the router for `**` patterns. Empty when the route didn't use `**`.

func (*URI) GetPathVariable added in v0.1.8

func (u *URI) GetPathVariable(key string) string

func (*URI) GetQuery added in v0.1.8

func (u *URI) GetQuery(key string) string

func (*URI) HasQuery added in v0.1.8

func (u *URI) HasQuery(key string) bool

func (*URI) SetPathRemainder added in v0.1.9

func (u *URI) SetPathRemainder(rest string)

SetPathRemainder is called by the router for `**` routes.

func (*URI) SetPathVariable added in v0.1.8

func (u *URI) SetPathVariable(key, value string)

Jump to

Keyboard shortcuts

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