router

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultJetRouter = NewJetRouter("0")

Functions

func ConvertToURL

func ConvertToURL(input string) string

ConvertToURL Convert uppercase-separated string to URL format like GetV1UsageWeek => get/v1/usage/week

func FirstRuneIsUp

func FirstRuneIsUp(input string) bool

func ParseUrl

func ParseUrl(ctx *fasthttp.RequestCtx) (queryStringMap maps.IMap[string, string])

func Register

func Register(rcvrs ...interface{})

func RegisterByInject

func RegisterByInject()

func ServeHTTP

func ServeHTTP(ctx *fasthttp.RequestCtx)

Types

type IJetRouter

type IJetRouter interface {
	ServeHTTP(ctx *fasthttp.RequestCtx)
	RegisterRouter(path string, handler handler.IHandler)
}

func NewJetRouter

func NewJetRouter(separator string, f ...SplitPathFunc) IJetRouter

type ITrie

type ITrie[V any] interface {
	Size() int
	IsEmpty() bool
	Clear()
	Contains(path string) bool
	Get(path string) V
	GetAndArgs(path string) (value V, args []string)
	Add(path string, v V) (overwrittenValue V)
	Remove(path string) (oldValue V)
	StartWith(prefix string) bool
}

func NewRouterTrie

func NewRouterTrie[V any](separator string, splitPathFuncs ...SplitPathFunc) ITrie[V]

func NewRouterTrieWith

func NewRouterTrieWith[V any](separator string, splitPathFunc SplitPathFunc, splitMethodFunc SplitMethodFunc) ITrie[V]

type JetRouter

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

func (*JetRouter) RegisterRouter

func (r *JetRouter) RegisterRouter(path string, handler handler.IHandler)

func (*JetRouter) ServeHTTP

func (r *JetRouter) ServeHTTP(ctx *fasthttp.RequestCtx)

type SplitMethodFunc

type SplitMethodFunc = func(k string, separator string) []string

type SplitPathFunc

type SplitPathFunc = func(k string) []string

type Trie

type Trie[V any] struct {
	// contains filtered or unexported fields
}

func (*Trie[V]) Add

func (t *Trie[V]) Add(path string, v V) (overwrittenValue V)

func (*Trie[V]) Clear

func (t *Trie[V]) Clear()

func (*Trie[V]) Contains

func (t *Trie[V]) Contains(path string) bool

func (*Trie[V]) Get

func (t *Trie[V]) Get(path string) (v V)

func (*Trie[V]) GetAndArgs

func (t *Trie[V]) GetAndArgs(path string) (v V, args []string)

func (*Trie[V]) IsEmpty

func (t *Trie[V]) IsEmpty() bool

func (*Trie[V]) Remove

func (t *Trie[V]) Remove(path string) (oldValue V)

func (*Trie[V]) Size

func (t *Trie[V]) Size() int

func (*Trie[V]) StartWith

func (t *Trie[V]) StartWith(prefix string) bool

type TrieNode

type TrieNode[V any] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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