router

package
v0.0.0-...-9816518 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 3 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Brace

func Brace(path string) *brace

Brace matches path with REST-full resources URI in brace form. e.g., "/foo/v1/bar/v2" will map to "/{foo}/{bar}" form, while the value of "foo" and "bar" are "v1" and "v2", respectively.

func Colon

func Colon(path string) *colon

Colon matches path with REST-full resources URI in perfix colon form. e.g., "/foo/v1/bar/v2" will map to "/:foo/:bar" form, while the value of "foo" and "bar" are "v1" and "v2", respectively.

func RegEx

func RegEx(path string) *regex

RegEx matches path using regular patterns. TODO Dumpping sub-patterns into url.Values.

func Wildcard

func Wildcard(path string) *wildcard

Wildcard matches paths with wildcard form. E.g., "/foo/v1/bar/v2" will match the form "/foo/*/bar/*", and "/foo/v1/v2/bar" will match the form "/foo/*/*/bar", but will not match "/foo/*/bar".

Types

type Base

type Base struct {
	Path string
}

func Simple

func Simple(path string) *Base

Simple router strictly matches paths.

func (*Base) Match

func (r *Base) Match(path string) (url.Values, bool)

type Router

type Router interface {
	Match(string) (url.Values, bool)
}

Router is an interface to match specific path.

Jump to

Keyboard shortcuts

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