jumux

package module
v0.0.0-...-3f16a3d Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ChrSetN = 123

Variables

This section is empty.

Functions

func GetParams

func GetParams(w http.ResponseWriter, params ...*string)

Types

type FasthttpMux

type FasthttpMux struct {
	*Rest[fasthttp.RequestHandler]
}

func NewFasthttpMux

func NewFasthttpMux(methodNotAllowed, notFound fasthttp.RequestHandler) *FasthttpMux

func (*FasthttpMux) Handler

func (m *FasthttpMux) Handler(ctx *fasthttp.RequestCtx)

type Mthd

type Mthd[T any] struct {
	GET, POST, DELETE, PUT, PATCH T
}

type NetHttpMux

type NetHttpMux struct {
	*Rest[http.HandlerFunc]
}

func NewNetHttpMux

func NewNetHttpMux(methodNotAllowed, notFound http.HandlerFunc) *NetHttpMux

func (*NetHttpMux) ServeHTTP

func (m *NetHttpMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Node

type Node[T any] struct {
	Chr  string
	Edge string
	Val  T
	Nds  []Node[T]
}

func PrmsWcNds

func PrmsWcNds[T any](path *string, i int, val T, prmsLen *int) (ndsRet []Node[T], iRet int)

type Nodes

type Nodes[T any] struct {
	Nds     []Node[T]
	PrmsLen int
}

func NewTrie

func NewTrie[T any]() *Nodes[T]

func (*Nodes[T]) Get

func (nodes *Nodes[T]) Get(path string) (ret T, notFound bool, params []string, wildcard string)

func (*Nodes[T]) Set

func (nodes *Nodes[T]) Set(path string, val T)

type PrmsWc

type PrmsWc struct {
	http.ResponseWriter
	Params   []string
	Wildcard string
}

type Rest

type Rest[T any] struct {
	*Nodes[Mthd[T]]
	Mthd[T]
	GetIsSet, PostIsSet, DeleteIsSet, PutIsSet, PatchIsSet bool
	MethodNotAllowed, NotFound                             T
}

func NewRest

func NewRest[T any](methodNotAllowed, notFound T) (rest *Rest[T])

func (*Rest[T]) Handle

func (m *Rest[T]) Handle(method, path string, action T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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