matcher
v1.0.0-20161101201550-7c6ce5d22d64
gopkg.in/celrenheit/lion.v1/matcher
Documentation
pkg.go.dev ↗Functions
Param
func Param(c context.Context, key string) string
Param returns the value of a url param base on the passed context
Types
Config
type Config struct {
ParamChar byte
WildcardChar byte
Separators string
GetSetterCreator GetSetterCreator
ParamTransformer ParamTransformer
}
Context
type Context interface {
context.Context
Param(key string) string
ParamOk(key string) (string, bool)
AddParam(key, value string)
Remove(key string)
Reset()
}
Context implements golang.org/x/net/context.Context and stores values of url parameters
C
func C(c context.Context) Context
C returns a Context based on a context.Context passed. If it does not convert to Context, it creates a new one with the context passed as argument.
NewContext
func NewContext() Context
NewContext creates a new context instance
NewContextWithParent
func NewContextWithParent(c context.Context) Context
NewContextWithParent creates a new context with a parent context specified
GetSetter
type GetSetter interface {
Set(value interface{}, tags Tags)
Get(tags Tags) interface{}
}
GetSetterCreator
type GetSetterCreator interface {
New() GetSetter
}
Matcher
type Matcher interface {
Set(pattern string, values interface{}, tags Tags)
Get(pattern string, tags Tags) (Context, interface{})
GetWithContext(c Context, pattern string, tags Tags) interface{}
}
Custom
func Custom(cfg *Config) Matcher
New
func New() Matcher
ParamTransformer
type ParamTransformer interface {
Transform(input string) (output string)
}
Parameter
type Parameter struct {
Key string
Val string
}
Tags
type Tags []string