routex

package
v0.2.27 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MethodConfig

type MethodConfig struct {
	Descriptor protoreflect.MethodDescriptor
	MethodPath string
}

type RouteMethods

type RouteMethods map[string]*RouteTarget

type RouteTarget

type RouteTarget struct {
	GrpcMethodName string
	HttpMethod     string
	HttpPath       []string
	Verb           string

	RequestBodyFieldPath  string
	RequestBodyFields     []protoreflect.FieldDescriptor
	ResponseBodyFieldPath string
	ResponseBodyFields    []protoreflect.FieldDescriptor
	Vars                  []RouteTargetVar
}

type RouteTargetVar

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

type RouteTargetVarMatch

type RouteTargetVarMatch struct {
	Fields []protoreflect.FieldDescriptor
	Value  string
	Name   string
}

type RouteTrie

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

RouteTrie is a prefix trie of valid REST URI paths to route targets. It supports evaluation of variables as the HttpPath is matched, for interpolating parts of the URI HttpPath into an RPC request field. The map is keyed by the HttpPath component that corresponds to a given node.

func NewRouteTrie

func NewRouteTrie() *RouteTrie

func (*RouteTrie) AddRoute

func (t *RouteTrie) AddRoute(grpcMethod string, mth protoreflect.MethodDescriptor) error

func (*RouteTrie) GetRouteMethods

func (t *RouteTrie) GetRouteMethods() []*RouteTarget

func (*RouteTrie) Match

func (t *RouteTrie) Match(uriPath, httpMethod string) (*RouteTarget, []RouteTargetVarMatch, RouteMethods)

Jump to

Keyboard shortcuts

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