argv

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	RequestKey         request.Key = "RequestArgv"
	RequestRedirectKey string      = "RequestRedirect"
	RequestIgnoredKey  string      = "RequestArgvIgnored"
	RequestConsumedKey string      = "RequestArgvConsumed"
)
View Source
const (
	PatternArgs  = `((?:/:[^/]+)+?)`
	PatternPgntn = `(/\d+/\d+/??)`
)
View Source
const (
	RouteOneArg  = `:{arg0:[^/]+}`
	RouteTwoArgs = `:{arg0:[^/]+}/:{arg1:[^/]+}`
	RoutePgntn   = `{num-per-page:\d+}/{page-number:\d+}`
)

Variables

View Source
var (
	RxRequestSplit = regexp.MustCompile(`/:`)
	RxRequestCase0 = regexp.MustCompile(`^(/[^:]+?)` + PatternArgs + PatternPgntn + `$`)
	RxRequestCase1 = regexp.MustCompile(`^(/[^:]+?)` + PatternPgntn + `$`)
	RxRequestCase2 = regexp.MustCompile(`^(/[^:]+?)` + PatternArgs + `$`)
	RxRequestCase3 = regexp.MustCompile(`^(/[^:]+?)$`)
)

Functions

func Middleware added in v0.5.0

func Middleware(next http.Handler) (this http.Handler)

Types

type Argv added in v0.5.0

type Argv struct {
	Path       string
	Argv       [][]string
	NumPerPage int
	PageNumber int
	Language   language.Tag
	Request    *http.Request
}

func DecodeHttpRequest

func DecodeHttpRequest(r *http.Request) (reqArgv *Argv)

func DecomposeHttpRequest

func DecomposeHttpRequest(r *http.Request) (reqArgv *Argv)

func Get added in v0.5.0

func Get(r *http.Request) (reqArgv *Argv)

func ProcessRequest added in v0.5.0

func ProcessRequest(r *http.Request) (argv *Argv, modified *http.Request)

func (*Argv) Copy added in v0.5.0

func (ra *Argv) Copy() (reqArg *Argv)

func (*Argv) MustConsume added in v0.5.0

func (ra *Argv) MustConsume() (must bool)

func (*Argv) Set added in v0.5.0

func (ra *Argv) Set(r *http.Request) (req *http.Request)

func (*Argv) String added in v0.5.0

func (ra *Argv) String() (argvUrl string)

type Pagination added in v0.5.0

type Pagination struct {
	// BasePath is the URL path to use when generating pagination links
	BasePath string `json:"BasePath"`
	// PageNumber is the current page number in human format (lists start at 1)
	PageNumber int `json:"PageNumber"`
	// NumPerPage is the number of results per page requested
	NumPerPage int `json:"NumPerPage"`
	// PageIndex is the current page number in computer format (lists start at 0)
	PageIndex int `json:"PageIndex"`
	// LastIndex is the last page number in computer format
	LastIndex int `json:"LastIndex"`
	// TotalItems is the total number of items available
	TotalItems int `json:"TotalItems"`
	// TotalPages is the total number of pagination pages available
	TotalPages int `json:"TotalPages"`
	// StartItem is the number of the first item being presented
	StartItem int `json:"StartItem"`
	// EndItem is the number of the last item being presented
	EndItem int `json:"EndItem"`
	// SearchQuery is an optional plain text string to be included with generated output
	SearchQuery string `json:"SearchQuery"`
}

Jump to

Keyboard shortcuts

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