Documentation ¶
Index ¶
- Constants
- func CityPathGenerator(webpage *Webpage) string
- func CreatePathMap(root HyperRenderer) map[string]HyperRenderer
- func GetPaths(node HyperRenderer) []string
- func NoOpVisit(hr HyperRenderer) bool
- type HyperRenderer
- type PathGeneratorfunc
- type VisitFunc
- type VisitedMap
- type Webpage
- func (wp *Webpage) AddChild(webpageType WebpageType, opts ...WebpageOption) *Webpage
- func (wp *Webpage) AddLink(page *Webpage)
- func (wp *Webpage) Clone(webpageType WebpageType) *Webpage
- func (wp *Webpage) CountLinksByType(t WebpageType) int
- func (wp *Webpage) Draw(format graphviz.Format, w io.Writer) error
- func (wp *Webpage) Faker() *gofakeit.Faker
- func (wp *Webpage) GetID() string
- func (wp *Webpage) GetLinks() []HyperRenderer
- func (wp *Webpage) GetPath() string
- func (wp *Webpage) Render(writer io.Writer) error
- type WebpageOption
- type WebpageType
Constants ¶
View Source
const ( WebpageTypeAuthority = "authority" WebpageTypeHub = "hub" )
Variables ¶
This section is empty.
Functions ¶
func CityPathGenerator ¶
func CreatePathMap ¶
func CreatePathMap(root HyperRenderer) map[string]HyperRenderer
func GetPaths ¶
func GetPaths(node HyperRenderer) []string
func NoOpVisit ¶
func NoOpVisit(hr HyperRenderer) bool
Types ¶
type HyperRenderer ¶
type HyperRenderer interface { GetID() string GetPath() string Render(wr io.Writer) error GetLinks() []HyperRenderer }
func FindHyperRendererByID ¶
func FindHyperRendererByID(root HyperRenderer, targetID string) HyperRenderer
func FindHyperRendererByPath ¶
func FindHyperRendererByPath(root HyperRenderer, path string) HyperRenderer
type PathGeneratorfunc ¶
type VisitFunc ¶
type VisitFunc func(HyperRenderer) bool
boolean value indicates whether the traversal should be terminated or not.
type VisitedMap ¶
type VisitedMap map[HyperRenderer]struct{}
func Traverse ¶
func Traverse(root HyperRenderer, f VisitFunc) VisitedMap
type Webpage ¶
type Webpage struct { ID uint64 Path string PathPrefix string Parent *Webpage Links []*Webpage Type WebpageType PathGenerator PathGeneratorfunc AuthorityTmpl *template.Template HubTmpl *template.Template CustomTmpl *template.Template }
func NewWebpage ¶
func NewWebpage( webpageType WebpageType, opts ...WebpageOption, ) *Webpage
func (*Webpage) AddChild ¶
func (wp *Webpage) AddChild(webpageType WebpageType, opts ...WebpageOption) *Webpage
func (*Webpage) Clone ¶
func (wp *Webpage) Clone(webpageType WebpageType) *Webpage
Clone creates a new Webpage instance based on the current one with a specified type, a unique ID, and no links.
func (*Webpage) CountLinksByType ¶
func (wp *Webpage) CountLinksByType(t WebpageType) int
func (*Webpage) GetLinks ¶
func (wp *Webpage) GetLinks() []HyperRenderer
type WebpageOption ¶
type WebpageOption func(*Webpage)
func WithAuthorityTemplate ¶
func WithAuthorityTemplate(tmpl *template.Template) WebpageOption
func WithCustomTemplate ¶
func WithCustomTemplate(tmpl *template.Template) WebpageOption
func WithHubTemplate ¶
func WithHubTemplate(tmpl *template.Template) WebpageOption
func WithPathGenerator ¶
func WithPathGenerator(f func(*Webpage) string) WebpageOption
func WithPathPrefix ¶
func WithPathPrefix(prefix string) WebpageOption
type WebpageType ¶
type WebpageType string
Click to show internal directories.
Click to hide internal directories.