router

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MethodNotFound = jErrors.ConstError("method not found")

Variables

This section is empty.

Functions

func MethodToString

func MethodToString(method MethodType) string

Types

type GrpcSpec

type GrpcSpec struct {
	RequestDesc  protoreflect.MessageDescriptor
	ResponseDesc protoreflect.MessageDescriptor
	Service      string
	Method       string
}

func (*GrpcSpec) FullPath

func (g *GrpcSpec) FullPath() string

type Match

type Match struct {
	Params   []transformer.Variable
	GrpcSpec *GrpcSpec
	Pattern  string
	BodyRule transformer.HTTPBodyRule
}

type MethodType

type MethodType uint
const (
	UnknownMethod MethodType = iota
	CONNECT
	DELETE
	GET
	HEAD
	OPTIONS
	PATCH
	POST
	PUT
	TRACE
)

func StringToMethod

func StringToMethod(method string) (MethodType, error)

type Route

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

func NewRoute

func NewRoute(pattern, body string, method MethodType, spec *GrpcSpec) *Route

func (*Route) GrpcSpec

func (r *Route) GrpcSpec() *GrpcSpec

func (*Route) Method

func (r *Route) Method() MethodType

func (*Route) Path

func (r *Route) Path() string

type Router

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

func NewRouter

func NewRouter() *Router

func NewRouterWithRoutes

func NewRouterWithRoutes(route []*Route) (*Router, error)

func (*Router) Find

func (r *Router) Find(method MethodType, path string) (result *Match)

func (*Router) Push

func (r *Router) Push(route *Route) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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