package paths
import "github.com/gobuffalo/plush/v5/helpers/paths"
Index ¶
- Constants
- func New() hctx.Map
- func PathFor(in interface{}) (string, error)
- type Paramable
- type Pathable
Constants ¶
const (
PathForKey = "pathFor"
)
Keys to be used in templates for the functions in this package.
Functions ¶
func New ¶
New returns a map of the helpers within this package.
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 ¶
type Paramable ¶
type Paramable interface { ToParam() string }
type Pathable ¶
type Pathable interface { ToPath() string }
Source Files ¶
- Version
- v5.0.5 (latest)
- Published
- May 23, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 weeks ago –
Tools for package owners.