router

package
v3.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIdFromPath

func GetIdFromPath(p string) (id, path string)

Returns the ID, last component, from a given path p. The path is split by '/' and the last component is returned as the ID. The other components are joined again and returned, starting with a leading slash.

func ShiftPath

func ShiftPath(p string) (head, tail string)

ShiftPath splits off the first component of p, which will be cleaned of relative components before processing. head will never contain a slash and tail will always be a rooted path without trailing slash. see https://blog.merovius.de/2017/06/18/how-not-to-use-an-http-router.html and https://gist.github.com/weatherglass/62bd8a704d4dfdc608fe5c5cb5a6980c#gistcomment-2161690 for the zero alloc code below.

Types

This section is empty.

Jump to

Keyboard shortcuts

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