interceptor

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Word   = ":word"
	Number = ":number"
)

Variables

This section is empty.

Functions

func Predefined added in v0.0.9

func Predefined() map[string]string

Types

type FileData added in v0.0.15

type FileData struct {
	Name string
	Size int64
	Data []byte
}

type HTTPAnswer added in v0.0.9

type HTTPAnswer struct {
	ResponseCode int
	Content      interface{}
	ContentType  string
}

func (*HTTPAnswer) Send added in v0.0.9

func (answer *HTTPAnswer) Send(w http.ResponseWriter)

type HTTPRegexp added in v0.0.9

type HTTPRegexp struct {
	List map[string]*regexp.Regexp
}

Регулярные выражения для проверки роутов

func (*HTTPRegexp) Add added in v0.0.9

func (reg *HTTPRegexp) Add(pattern, regExpPattern string)

func (*HTTPRegexp) AddPredefined added in v0.0.9

func (reg *HTTPRegexp) AddPredefined(predefined []string)

func (*HTTPRegexp) Init added in v0.0.9

func (reg *HTTPRegexp) Init()

func (*HTTPRegexp) MatchURIParts added in v0.0.9

func (reg *HTTPRegexp) MatchURIParts(routeURIParts, requestURLParts []string) bool

type HTTPRoute added in v0.0.9

type HTTPRoute struct {
	Method string
	URI    string
	F      func(http.ResponseWriter, *http.Request)
}

Один Роут и методы его сравнения

func (*HTTPRoute) MatchMethod added in v0.0.9

func (route *HTTPRoute) MatchMethod(r *http.Request) bool

func (*HTTPRoute) MatchURI added in v0.0.9

func (route *HTTPRoute) MatchURI(r *http.Request, regexp HTTPRegexp) bool

type HTTPRouter added in v0.0.9

type HTTPRouter struct {
	Routes                []HTTPRoute
	DefaultNotFoundAnswer HTTPAnswer
	HTTPRegexp
}

func (*HTTPRouter) HandleFunc added in v0.0.9

func (router *HTTPRouter) HandleFunc(method, uri string, f func(http.ResponseWriter, *http.Request))

func (*HTTPRouter) Init added in v0.0.9

func (router *HTTPRouter) Init()

func (*HTTPRouter) ServeHTTP added in v0.0.9

func (router *HTTPRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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