Documentation ¶
Index ¶
- Constants
- func ErrorCode(err error) string
- func ErrorMessage(err error) string
- type Adder
- type DOTEdge
- type DOTNode
- type Edge
- type EdgeUpdater
- type Error
- type Graph
- type LabelSetter
- type Loader
- type Marshaler
- type Node
- type NodeUpdater
- type Remover
- type Styler
- type Syncer
- type UIDSetter
- type Unmarshaler
- type Updater
- type WeightSetter
Constants ¶
const ( EINTERNAL = "internal" EINVALID = "invalid" ENOTFOUND = "not_found" ENOTIMPLEMENTED = "not_implemented" EUNSUPPORTED = "unsupported" )
Application error codes.
NOTE: These are meant to be generic and they map well to HTTP error codes. Different applications can have very different error code requirements so these should be expanded as needed (or introduce subcodes).
Variables ¶
This section is empty.
Functions ¶
func ErrorCode ¶
ErrorCode unwraps an application error and returns its code. Non-application errors always return EINTERNAL.
func ErrorMessage ¶
ErrorMessage unwraps an application error and returns its message. Non-application errors always return "Internal error".
Types ¶
type Adder ¶
type Adder interface { Graph graph.NodeAdder graph.WeightedEdgeAdder }
Adder allows to add edges and nodes to graph.
type DOTNode ¶
type DOTNode interface { Node encoding.Attributer // DOTID returns DOT ID. DOTID() string // SetDOTID sets DOT ID. SetDOTID(dotid string) }
DOTNode is Graphviz DOT node.
type Edge ¶
type Edge interface { graph.WeightedEdge // UID returns edge UID. UID() string // Label returns edge label. Label() string // Attrs returns node attributes. Attrs() map[string]interface{} }
Edge is a graph edge.
type EdgeUpdater ¶
type EdgeUpdater interface { Graph graph.WeightedEdgeAdder graph.EdgeRemover }
EdgeUpdater adds and removes edges.
type Error ¶
type Error struct { // Machine-readable error code. Code string // Human-readable error message. Message string }
Error represents an application-specific error. Application errors can be unwrapped by the caller to extract out the code & message.
Any non-application error (such as a disk error) should be reported as an EINTERNAL error and the human user should only see "Internal error" as the message. These low-level internal error details should only be logged and reported to the operator of the application (not the end user).
type Graph ¶
type Graph interface { graph.Weighted // UID returns graph UID. UID() string // Edges returns graph edges iterator. Edges() graph.Edges // Label returns graph label. Label() string // Attrs are graph attributes. Attrs() map[string]interface{} }
Graph is weighted graph.
type Node ¶
type Node interface { graph.Node // UID returns node UID. UID() string // Label returns node label. Label() string // Attrs returns node attributes. Attrs() map[string]interface{} }
Node is a graph node.
type NodeUpdater ¶
type NodeUpdater interface { Graph graph.NodeAdder graph.NodeRemover }
NodeUpdater adds and removes nodes.
type Remover ¶
type Remover interface { Graph graph.NodeRemover graph.EdgeRemover }
Remover allows to remove nodes and edges from graph.
type Styler ¶
type Styler interface { // Type returns the type of style. Type() string // Shape returns style shape. Shape() string // Color returns style color. Color() color.RGBA }
Styler is used for styling.
type Unmarshaler ¶
type Unmarshaler interface { // Unmarshal unmarshals arbitrary bytes into graph. Unmarshal([]byte, Graph) error }
Unmarshaler is used for unmarshaling graphs.