pathmatchpb

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_v1_pathmatch_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type DoubleStar

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

DoubleStar represents a multi-segment wildcard character ('**'). It matches zero or more path segments. It must be the last segment in the main path template or in a variable's sub-pattern.

func (*DoubleStar) Descriptor deprecated

func (*DoubleStar) Descriptor() ([]byte, []int)

Deprecated: Use DoubleStar.ProtoReflect.Descriptor instead.

func (*DoubleStar) ProtoMessage

func (*DoubleStar) ProtoMessage()

func (*DoubleStar) ProtoReflect

func (x *DoubleStar) ProtoReflect() protoreflect.Message

func (*DoubleStar) Reset

func (x *DoubleStar) Reset()

func (*DoubleStar) String

func (x *DoubleStar) String() string

type Literal

type Literal struct {

	// The string value of the literal segment.
	// e.g., "users", "profile".
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Literal represents a fixed string segment in a path.

func (*Literal) Descriptor deprecated

func (*Literal) Descriptor() ([]byte, []int)

Deprecated: Use Literal.ProtoReflect.Descriptor instead.

func (*Literal) GetValue

func (x *Literal) GetValue() string

func (*Literal) ProtoMessage

func (*Literal) ProtoMessage()

func (*Literal) ProtoReflect

func (x *Literal) ProtoReflect() protoreflect.Message

func (*Literal) Reset

func (x *Literal) Reset()

func (*Literal) String

func (x *Literal) String() string

type PathTemplate

type PathTemplate struct {

	// The path template is represented as a sequence of segments.
	Segments []*Segment `protobuf:"bytes,1,rep,name=segments,proto3" json:"segments,omitempty"`
	// contains filtered or unexported fields
}

PathTemplate defines the abstract syntax tree (AST) for a parsed path pattern. This structure is used to store and interpret path matching rules.

The grammar for path templates can be summarized as: Template = "/" [ Segments ] ; Segments = Segment { "/" Segment } ; Segment = "*" | "**" | LITERAL | Variable ; Variable = "{" LITERAL [ "=" Segments ] "}" ; // LITERAL here is the variable name

Examples: - /users/{id}/profile - /files/** - /archive/{year}/{month=**} - /v1/books/{book_id} - /

func (*PathTemplate) Descriptor deprecated

func (*PathTemplate) Descriptor() ([]byte, []int)

Deprecated: Use PathTemplate.ProtoReflect.Descriptor instead.

func (*PathTemplate) GetSegments

func (x *PathTemplate) GetSegments() []*Segment

func (*PathTemplate) ProtoMessage

func (*PathTemplate) ProtoMessage()

func (*PathTemplate) ProtoReflect

func (x *PathTemplate) ProtoReflect() protoreflect.Message

func (*PathTemplate) Reset

func (x *PathTemplate) Reset()

func (*PathTemplate) String

func (x *PathTemplate) String() string

type Segment

type Segment struct {

	// Types that are valid to be assigned to Segment:
	//
	//	*Segment_Literal
	//	*Segment_Variable
	//	*Segment_Star
	//	*Segment_DoubleStar
	Segment isSegment_Segment `protobuf_oneof:"segment"`
	// contains filtered or unexported fields
}

Segment represents a single component of a path template.

func (*Segment) Descriptor deprecated

func (*Segment) Descriptor() ([]byte, []int)

Deprecated: Use Segment.ProtoReflect.Descriptor instead.

func (*Segment) GetDoubleStar

func (x *Segment) GetDoubleStar() *DoubleStar

func (*Segment) GetLiteral

func (x *Segment) GetLiteral() *Literal

func (*Segment) GetSegment

func (x *Segment) GetSegment() isSegment_Segment

func (*Segment) GetStar

func (x *Segment) GetStar() *Star

func (*Segment) GetVariable

func (x *Segment) GetVariable() *Variable

func (*Segment) ProtoMessage

func (*Segment) ProtoMessage()

func (*Segment) ProtoReflect

func (x *Segment) ProtoReflect() protoreflect.Message

func (*Segment) Reset

func (x *Segment) Reset()

func (*Segment) String

func (x *Segment) String() string

type Segment_DoubleStar

type Segment_DoubleStar struct {
	DoubleStar *DoubleStar `protobuf:"bytes,4,opt,name=double_star,json=doubleStar,proto3,oneof"`
}

type Segment_Literal

type Segment_Literal struct {
	Literal *Literal `protobuf:"bytes,1,opt,name=literal,proto3,oneof"`
}

type Segment_Star

type Segment_Star struct {
	Star *Star `protobuf:"bytes,3,opt,name=star,proto3,oneof"`
}

type Segment_Variable

type Segment_Variable struct {
	Variable *Variable `protobuf:"bytes,2,opt,name=variable,proto3,oneof"`
}

type Star

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

Star represents a single-segment wildcard character ('*'). It matches exactly one segment in the path.

func (*Star) Descriptor deprecated

func (*Star) Descriptor() ([]byte, []int)

Deprecated: Use Star.ProtoReflect.Descriptor instead.

func (*Star) ProtoMessage

func (*Star) ProtoMessage()

func (*Star) ProtoReflect

func (x *Star) ProtoReflect() protoreflect.Message

func (*Star) Reset

func (x *Star) Reset()

func (*Star) String

func (x *Star) String() string

type Variable

type Variable struct {

	// The name of the variable, e.g., "id" in "{id}".
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Optional. If present, defines a sub-pattern that the variable must match.
	// e.g., for "{filePath=/docs/**}", segments would represent "/docs/**".
	// If the variable is simple (e.g., "{id}"), this list will be empty.
	Segments []*Segment `protobuf:"bytes,2,rep,name=segments,proto3" json:"segments,omitempty"` // e.g. "foo/*" or "**"
	// contains filtered or unexported fields
}

Variable represents a named placeholder in a path template. It can match a single segment (e.g., "{id}") or multiple segments if a sub-pattern is defined (e.g., "{filePath=/docs/**}").

Limitations:

  • Nested variables (e.g., "{outer={inner}}") are not allowed.
  • The sub-pattern defined after '=' (e.g., in "{name=pattern}") cannot itself contain variables. It can only contain literals, single wildcards ('*'), or a double wildcard ('**') at the very end of the pattern.

func (*Variable) Descriptor deprecated

func (*Variable) Descriptor() ([]byte, []int)

Deprecated: Use Variable.ProtoReflect.Descriptor instead.

func (*Variable) GetName

func (x *Variable) GetName() string

func (*Variable) GetSegments

func (x *Variable) GetSegments() []*Segment

func (*Variable) ProtoMessage

func (*Variable) ProtoMessage()

func (*Variable) ProtoReflect

func (x *Variable) ProtoReflect() protoreflect.Message

func (*Variable) Reset

func (x *Variable) Reset()

func (*Variable) String

func (x *Variable) String() string

Jump to

Keyboard shortcuts

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