runtime

package
v0.0.0-...-9146478 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Matcher

type Matcher interface {
	Match(path string) (map[string]string, error)
	IsStatic() bool
	Fields() []string
	Pattern() string
}

Matcher .

func Compile

func Compile(path string) (Matcher, error)

Compile .

type Pattern

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

Pattern is a template pattern of http request paths defined in https://github.com/googleapis/googleapis/blob/master/google/api/http.proto

func MustPattern

func MustPattern(p Pattern, err error) Pattern

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) (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.

func (Pattern) Match

func (p Pattern) Match(components []string, verb string) (map[string]string, error)

Match examines components if it matches to the Pattern. If it matches, the function returns a mapping from field paths to their captured values. If otherwise, the function returns an error.

func (Pattern) String

func (p Pattern) String() string

func (Pattern) Verb

func (p Pattern) Verb() string

Verb returns the verb part of the Pattern.

Jump to

Keyboard shortcuts

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