routes

package
v0.0.0-...-08b82ef Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileHandler

func FileHandler(rootDir string) func(http.ResponseWriter, *http.Request)

FileHandler provides a static file lookup route using the OS file system

func LinksHandler

func LinksHandler(allowedSites []string) func(http.ResponseWriter, *http.Request)

LinksHandler generates a route handler that returns links.

func SetVerboseError

func SetVerboseError(verbose bool)

SetVerboseError sets the flag determining if the client should receive error details

func TreeGraphHandler

func TreeGraphHandler(allowedSites []string) func(http.ResponseWriter, *http.Request)

TreeGraphHandler generates a route handler that returns a treegraph structure.

Types

type Graph

type Graph struct {
	URL  string `json:"url"`
	Root *Node  `json:"root"`
}

Graph is a collection of nodes with a single root.

type Node

type Node struct {
	Key        string       `json:"key"`
	Neighbours []*Node      `json:"neighbours"`
	Data       *Proposition `json:"data"`
}

Node is one entity in a graph.

type Proposition

type Proposition struct {
	ID            string   `json:"id"`
	FullName      string   `json:"fullname"`
	Tag           string   `json:"tag"`
	Code          string   `json:"code"`
	URL           string   `json:"url"`
	Key           string   `json:"key"`
	PotentialTags []string `json:"potentialTags"`
	ParentURL     string   `json:"parentUrl"`
}

Proposition is an entity being extracted from a site.

func (*Proposition) ToPropertySlice

func (p *Proposition) ToPropertySlice() []string

ToPropertySlice converts a proposition to a string slice.

type TreeGraph

type TreeGraph struct {
	Items []*TreeGraphItem `json:"items"`
}

TreeGraph is a transformed graph to match the expected treegraph structure.

type TreeGraphItem

type TreeGraphItem struct {
	ID    string `json:"id"`
	Value int    `json:"value,omitempty"`
}

TreeGraphItem is an item in the treegraph structure.

type TreemapItem

type TreemapItem struct {
	Children []*TreemapItem `json:"children"`
	Name     string         `json:"name"`
	ColName  string         `json:"colname,omitempty"`
	Value    int            `json:"value,omitempty"`
}

TreemapItem is a transformed graph to match the expected treemap structure.

Jump to

Keyboard shortcuts

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