route

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool added in v0.1.5

func Bool(params map[string]string, name string) (bool, bool, error)

Bool returns an optional route param decoded as a bool.

func Float64 added in v0.1.5

func Float64(params map[string]string, name string) (float64, bool, error)

Float64 returns an optional route param decoded as a float64.

func Int added in v0.1.5

func Int(params map[string]string, name string) (int, bool, error)

Int returns an optional route param decoded as an int.

func Int64 added in v0.1.5

func Int64(params map[string]string, name string) (int64, bool, error)

Int64 returns an optional route param decoded as an int64.

func Match

func Match(pattern, requestPath string) (map[string]string, bool)

Match compares a concrete request path to a simple generated route pattern. Parameter segments use "{name}" and reject empty, ".", and ".." values. A final "{name...}" rest segment matches one or more remaining request segments; the captured value is those segments joined with "/".

func Required added in v0.1.5

func Required(params map[string]string, name string) (string, error)

Required returns a required route param.

func String added in v0.1.5

func String(params map[string]string, name string) (string, bool, error)

String returns an optional route param as a string.

func Uint added in v0.1.5

func Uint(params map[string]string, name string) (uint, bool, error)

Uint returns an optional route param decoded as a uint.

func Uint64 added in v0.1.5

func Uint64(params map[string]string, name string) (uint64, bool, error)

Uint64 returns an optional route param decoded as a uint64.

Types

type ParamError added in v0.1.5

type ParamError struct {
	Name    string
	Type    string
	Missing bool
	Err     error
}

ParamError describes a failed route-param decode without exposing the raw request value.

func (ParamError) Error added in v0.1.5

func (err ParamError) Error() string

func (ParamError) Unwrap added in v0.1.5

func (err ParamError) Unwrap() error

Jump to

Keyboard shortcuts

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