Documentation ¶
Index ¶
- func DefaultIncludeFunc(path, fileName string) bool
- func DefaultPathFunc(fileName string) string
- type Generator
- func (g *Generator) Generate() error
- func (g *Generator) SetDir(dir string) *Generator
- func (g *Generator) SetIncludeFunc(f func(path, fileName string) bool) *Generator
- func (g *Generator) SetPackageName(packageName string) *Generator
- func (g *Generator) SetPathFunc(f func(fileName string) string) *Generator
- func (g *Generator) SetRecursive(recursive bool) *Generator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultIncludeFunc ¶
DefaultIncludeFunc will return true for any file which ends with .vugu.
func DefaultPathFunc ¶
DefaultPathFunc will return the fileName with any suffix removed and a slash prepended. E.g. file name "example.vugu" will return "/example". The special case of index.vugu will return "/".
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator performs route generation on a given directory (and optionally sub-directories)
func (*Generator) SetIncludeFunc ¶
SetIncludeFunc sets the function which determines which files are included in the route map. The include function will be passed the path relative to the dir set by SetDir (and will be empty for files in that directory) and fileName will contain the base file name. E.g. given SetDir("/a") "/a/b.vugu" will result in a call with ("", "b.vugu"), and "/a/b/c.vugu" will result in a call with ("b", "c.vugu"), "/a/b/c/d.vugu" with ("b/c", "d.vugu") and so on.
func (*Generator) SetPackageName ¶
SetPackageName sets the fully qualified package name that corresponds with the directory set with SetDir.
func (*Generator) SetPathFunc ¶
SetPathFunc sets a function which transforms. If not set, DefaultPathFunc will be used.
func (*Generator) SetRecursive ¶
SetRecursive if passed true will enable the generator recursing into sub-directories.