Documentation ¶
Index ¶
Constants ¶
View Source
const (
PathForKey = "pathFor"
)
Keys to be used in templates for the functions in this package.
Variables ¶
This section is empty.
Functions ¶
func PathFor ¶
PathFor takes an `interface{}`, or a `slice` of them, and tries to convert it to a `/foos/{id}` style URL path. Rules: * if `string` it is returned as is * if `Pathable` the `ToPath` method is returned * if `slice` or an `array` each element is run through the helper then joined * if `struct` the name of the struct, pluralized is used for the name * if `Paramable` the `ToParam` method is used to fill the `{id}` slot * if `struct.Slug` the slug is used to fill the `{id}` slot of the URL * if `struct.ID` the ID is used to fill the `{id}` slot of the URL
Types ¶
Click to show internal directories.
Click to hide internal directories.