Documentation ¶
Index ¶
- Constants
- type Route
- func (r *Route) GetRoute(name string) *Route
- func (r *Route) Match(path string) (bool, *Route, vars.Vars)
- func (r *Route) Register(name, path string, callable func(v vars.Vars, u *url.URL)) *Route
- func (r *Route) String() string
- func (r *Route) StringIndent(sb *strings.Builder, level int)
- func (r *Route) URL(args ...any) string
Constants ¶
View Source
const ( RT_PATH_VAR_PREFIX = "<<" RT_PATH_VAR_SUFFIX = ">>" RT_PATH_VAR_DELIM = ":" )
Router regex delimiters
View Source
const ( NameInt = "int" NameString = "string" NameSlug = "slug" NameUUID = "uuid" NameAny = "any" NameHex = "hex" )
Router regex types.
View Source
const ( // Match any character RT_PATH_REGEX_ANY = ".+" // Match any number RT_PATH_REGEX_NUM = "[0-9]+" // Match any string RT_PATH_REGEX_STR = "[a-zA-Z]+" // Match any hex number RT_PATH_REGEX_HEX = "[0-9a-fA-F]+" // Match any UUID RT_PATH_REGEX_UUID = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" // Match any alphanumeric string RT_PATH_REGEX_ALPHANUMERIC = "[0-9a-zA-Z_-]+" )
Router regex patterns
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Route ¶
type Route struct { Name string Internal_name string Path string Callable func(v vars.Vars, u *url.URL) RegexUrl string SkipTrailingSlash bool Children []*Route }
Routes to be registered in the router
func (*Route) Match ¶
If the path matches the route, return true and the named capture groups If capture group is not named, returns $1, $2, etc.
Click to show internal directories.
Click to hide internal directories.