Documentation ¶
Index ¶
Constants ¶
const ( // OpNop does nothing OpNop = OpCode(iota) // OpPush pushes a component to stack OpPush // OpLitPush pushes a component to stack if it matches to the literal OpLitPush // OpPushM concatenates the remaining components and pushes it to stack OpPushM // OpConcatN pops N items from stack, concatenates them and pushes it back to stack OpConcatN // OpCapture pops an item and binds it to the variable OpCapture // OpEnd is the least positive invalid opcode. OpEnd )
These constants are the valid values of OpCode.
Variables ¶
var ( // ErrNotMatch indicates that the given HTTP request path does not match to the pattern. ErrNotMatch = errors.New("not match to the path pattern") // ErrInvalidPattern indicates that the given definition of Pattern is not valid. ErrInvalidPattern = errors.New("invalid pattern") )
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler interface {
Compile() Template
}
Compiler compiles utilities representation of path templates into marshallable operations. They can be unmarshalled by runtime.NewPattern.
type InvalidTemplateError ¶
type InvalidTemplateError struct {
// contains filtered or unexported fields
}
InvalidTemplateError indicates that the path template is not valid.
func (InvalidTemplateError) Error ¶
func (e InvalidTemplateError) Error() string
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern is a template pattern of http request paths defined in github.com/googleapis/googleapis/google/api/http.proto.
func MustPattern ¶
MustPattern is a helper function which makes it easier to call NewPattern in variable initialization.
func NewPattern ¶
func NewPattern(version int, ops []int, pool []string, verb string, opts ...PatternOpt) (Pattern, error)
NewPattern returns a new Pattern from the given definition values. "ops" is a sequence of op codes. "pool" is a constant pool. "verb" is the verb part of the pattern. It is empty if the pattern does not have the part. "version" must be 1 for now. It returns an error if the given definition is invalid.
type PatternOpt ¶
type PatternOpt func(*patternOptions)
PatternOpt is an option for creating Patterns.
func AssumeColonVerbOpt ¶
func AssumeColonVerbOpt(val bool) PatternOpt
AssumeColonVerbOpt indicates whether a path suffix after a final colon may only be interpreted as a verb.
type Template ¶
type Template struct { // Version is the version number of the format. Version int // OpCodes is a sequence of operations. OpCodes []int // Pool is a constant pool Pool []string // Verb is a VERB part in the template. Verb string // Fields is a list of field paths bound in this template. Fields []string // Original template (example: /v1/a_bit_of_everything) Template string }
Template is a compiled representation of path templates.