layer

package
v0.0.0-...-cd00165 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx *HandlerCtx)

type HandlerCtx

type HandlerCtx struct {
	*fasthttp.RequestCtx
	UriParams  map[string]string
	UserParams map[string]any
	Runner     INextHandler
}

func (*HandlerCtx) Next

func (s *HandlerCtx) Next()

type INextHandler

type INextHandler interface {
	GetNextHandler(*HandlerCtx) Handler
}

type INormalizer

type INormalizer interface {
	Normalize(layer Layer) Layer
}

type IRegExpMaker

type IRegExpMaker interface {
	MakeRegExp(Layer) *regexp.Regexp
}

type Layer

type Layer struct {
	Handlers []Handler

	Name         string
	Path         string
	RegExp       *regexp.Regexp
	Priority     int
	Methods      []string
	Restrictions Restrictions

	Meta map[string]any
}

func (Layer) WithHandlers

func (l Layer) WithHandlers(handlers ...Handler) Layer

type Restrictions

type Restrictions map[string]string

type StdNormalizer

type StdNormalizer struct {
	RegExpMaker IRegExpMaker
	// contains filtered or unexported fields
}

func (*StdNormalizer) Normalize

func (n *StdNormalizer) Normalize(layer Layer) Layer

Normalize -

type StdRegExpMaker

type StdRegExpMaker struct{}

func (*StdRegExpMaker) MakeRegExp

func (maker *StdRegExpMaker) MakeRegExp(l Layer) *regexp.Regexp

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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