Documentation
¶
Index ¶
- Variables
- type DoubleStar
- type Literal
- type PathTemplate
- type Segment
- func (*Segment) Descriptor() ([]byte, []int)deprecated
- func (x *Segment) GetDoubleStar() *DoubleStar
- func (x *Segment) GetLiteral() *Literal
- func (x *Segment) GetSegment() isSegment_Segment
- func (x *Segment) GetStar() *Star
- func (x *Segment) GetVariable() *Variable
- func (*Segment) ProtoMessage()
- func (x *Segment) ProtoReflect() protoreflect.Message
- func (x *Segment) Reset()
- func (x *Segment) String() string
- type Segment_DoubleStar
- type Segment_Literal
- type Segment_Star
- type Segment_Variable
- type Star
- type Variable
Constants ¶
This section is empty.
Variables ¶
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) ProtoMessage ¶
func (*Literal) ProtoMessage()
func (*Literal) ProtoReflect ¶
func (x *Literal) ProtoReflect() protoreflect.Message
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) GetDoubleStar ¶
func (x *Segment) GetDoubleStar() *DoubleStar
func (*Segment) GetLiteral ¶
func (*Segment) GetSegment ¶
func (x *Segment) GetSegment() isSegment_Segment
func (*Segment) GetVariable ¶
func (*Segment) ProtoMessage ¶
func (*Segment) ProtoMessage()
func (*Segment) ProtoReflect ¶
func (x *Segment) ProtoReflect() protoreflect.Message
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) ProtoMessage ¶
func (*Star) ProtoMessage()
func (*Star) ProtoReflect ¶
func (x *Star) ProtoReflect() protoreflect.Message
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) GetSegments ¶
func (*Variable) ProtoMessage ¶
func (*Variable) ProtoMessage()
func (*Variable) ProtoReflect ¶
func (x *Variable) ProtoReflect() protoreflect.Message