model

package
v0.4.1-0...-1fefb53 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute interface {
	// Key is the value of the attribute identifier. This must always be a string.
	Key() string
	// Kind represent the value type.
	Kind() Kind
	// IsNull will return true if the attribute type is null.
	IsNull() bool
	// AsBool will return the attribute values as a boolean.
	AsBool() (bool, error)
	// AsInt will return the attribute value as an int.
	AsInt() (int64, error)
	// AsFloat will return the attribute value as a float.
	AsFloat() (float64, error)
	// AsString will return the attribute value as a string.
	AsString() (string, error)
	// AsAny returns the value of the attribute with no type checking.
	AsAny() interface{}
}

Attribute defines methods of an attribute object.

type AttributeSet

type AttributeSet interface {
	// Exists returns whether a key, value with type pair exists
	Exists(Attribute) (bool, error)
	// Find returns all values associated with a specified key
	Find(string) Attribute
	// List will list all key,value pairs for the attributes in a
	// consumable format.
	List() map[string]Attribute
	// Len returns the attribute set length
	Len() int
	// MarshalJSON returns a json representation of the Attribute set.
	// Compliant with std lib JSON marshaler.
	MarshalJSON() ([]byte, error)
}

AttributeSet defines methods for manipulating attribute sets. Nodes have set of attributes that allow them to self-describe and describe connected nodes.

type DirectedGraph

type DirectedGraph interface {
	// Nodes lists all nodes contained within the
	// graph.
	Nodes() []Node
	// Edges lists all edges contained within the
	// graph.
	Edges() []Edge
	// NodeByID returns a node from the given
	// id, if existing.
	NodeByID(string) Node
	// Edge creates or returns an Edge from the given
	// node ids.
	Edge(string, string) Edge
	// HasEdgeFromTo returns whether an edge exits between
	// two nodes.
	HasEdgeFromTo(string, string) bool
	// From lists all child nodes for a given node
	// id, if existing.
	From(string) []Node
	// To lists all parent nodes for a given node
	// id, if existing.
	To(string) []Node
}

DirectedGraph defines methods for interacting with groups of nodes and edges in a directed graph structure. This graph may or may not contain cycles.

type Edge

type Edge interface {
	// To is the destination node.
	To() Node
	// From is the origin node.
	From() Node
}

Edge defines methods for node relationship information. This may eventually include weight information to represent nodes at addresses that are a longer distance from the source.

type Iterator

type Iterator interface {
	// Next returns true if there is more data to iterate
	// and will increment.
	Next() bool
	// Node will return the node in the current position.
	Node() Node
	// Reset will start the iterator from the beginning
	Reset()
	// Error will return all accumulated errors during iteration.
	Error() error
}

Iterator defines method for traversing node data in a specified order.

type Kind

type Kind int

Kind represents the kind of Attributes.

const (
	KindInvalid Kind = iota
	KindNull
	KindBool
	KindInt
	KindFloat
	KindString
)

func (Kind) String

func (k Kind) String() string

String prints a string representation of the attribute kind.

type Matcher

type Matcher interface {
	Matches(node Node) (bool, error)
}

Matcher defines an interface used for node filtering.

type MatcherFunc

type MatcherFunc func(node Node) (bool, error)

MatcherFunc is function signature that implements the Matcher interface.

func (MatcherFunc) Matches

func (fn MatcherFunc) Matches(node Node) (bool, error)

Matches filters nodes by matcher criteria.

type Node

type Node interface {
	// ID is a unique value assigned to the node.
	ID() string
	// Address is the location where the data is stored
	Address() string
	// Attributes defines the attributes associated
	// with the node data
	Attributes() AttributeSet
}

Node defines read-only methods implemented by different node types.

type NodeBuilder

type NodeBuilder interface {
	// Build create a new immutable node.
	Build(string) (Node, error)
}

NodeBuilder defines methods to build new nodes.

type Rooted

type Rooted interface {
	Root() (Node, error)
}

Rooted defines methods to locate the root of the data set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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