roanav

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortalTypeBlue   = "blue"
	PortalTypeYellow = "yellow"
)
View Source
const (
	MarkedMapColorNone   = "none"
	MarkedMapColorGreen  = "green"
	MarkedMapColorPink   = "pink"
	MarkedMapColorPurple = "purple"
	MarkedMapColorOrange = "orange"
	MarkedMapColorBrown  = "brown"
)
View Source
const (
	PlantUMLStyleAuto     = "auto" // if len(edges)<32 use plantuml else use dot
	PlantUMLStylePlantUML = "plantuml"
	PlantUMLStyleDOT      = "dot"
)
View Source
const (
	DefaultKrokiEndpoint = "https://kroki.io"
	DefaultKrokiTimeout  = 60 * time.Second // kroki.io is so slow :(
)
View Source
const (
	// NavigationDataMarkedMaps is the key for the marked maps data.
	// The value must be a JSON-encoded list of MarkedMap.
	NavigationDataMarkedMaps = "marked"
)
View Source
const (
	PortalDataKeyUser = "user"
)

Variables

This section is empty.

Functions

func BriefNavigation

func BriefNavigation(n *Navigation, mapData map[string]data.MapData) string

func BriefPortal

func BriefPortal(p *Portal, mapData map[string]data.MapData) string

Types

type KrokiPlantUMLPNGPainter

type KrokiPlantUMLPNGPainter struct {
	Client  kroki.Client
	MapData map[string]data.MapData
	Style   string
}

func NewKrokiPlantUMLPNGPainter added in v1.5.0

func NewKrokiPlantUMLPNGPainter(endpoint string, timeout time.Duration, mapData map[string]data.MapData, style string) *KrokiPlantUMLPNGPainter

func (*KrokiPlantUMLPNGPainter) NavigationToTemplateData

func (p *KrokiPlantUMLPNGPainter) NavigationToTemplateData(n *Navigation, t time.Time) (templateData, error)

func (*KrokiPlantUMLPNGPainter) Paint

func (p *KrokiPlantUMLPNGPainter) Paint(n *Navigation) (path string, err error)

func (*KrokiPlantUMLPNGPainter) ToPlantUML

func (p *KrokiPlantUMLPNGPainter) ToPlantUML(n *Navigation) (string, error)

type MarkedMap added in v1.6.0

type MarkedMap struct {
	ID      string `json:"id"`
	Color   string `json:"color"`
	Comment string `json:"comment"`
	// User who added the entry. Currently only used for display.
	// NOTE: consider using `Data map[string]string` instead, for code consistency.
	User string `json:"user"`
}

MarkedMap holds the data of a marked map.

type Navigation struct {
	// Name is the name of the navigation, usually the name of the channel+guild.
	Name string `json:"name"`
	// Portals is the list of portals.
	Portals []*Portal `json:"portals"`

	// Data contains additional data.
	Data map[string]string `json:"data"`
}

func NewNavigation

func NewNavigation(name string) *Navigation

NewNavigation initializes a Navigation.

func (n *Navigation) AddPortal(p *Portal)

AddPortal adds a portal to the navigation.

func (n *Navigation) DeepCopy() *Navigation
func (n *Navigation) DeepCopyInto(out *Navigation)
func (n *Navigation) DeleteExpiredPortals()

DeleteExpiredPortals deletes expired portals.

type Painter

type Painter interface {
	Paint(n *Navigation) (path string, err error)
}

type Portal

type Portal struct {
	// From is the map with a smaller name. Note that Route is an undirected path.
	From string `json:"from"`
	// To is the map with a larger name. Note that Route is an undirected path.
	To string `json:"to"`
	// Type is the portal type.
	Type      string    `json:"type"`
	ExpiredAt time.Time `json:"expired_at"`

	// Data contains additional data.
	// E.g. the user who added the portal.
	Data map[string]string `json:"data"`
}

func NewPortal

func NewPortal(map1, map2, typ string, expiredAt time.Time, data map[string]string) *Portal

NewPortal initializes a Portal. map1 and map2 are sorted in alphabetical order, then the smaller one is set to Portal.From and the other is set to Portal.To.

func (*Portal) DeepCopy added in v1.7.0

func (p *Portal) DeepCopy() *Portal

func (*Portal) DeepCopyInto added in v1.7.0

func (p *Portal) DeepCopyInto(out *Portal)

Jump to

Keyboard shortcuts

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