entity

package
v0.0.0-...-0bc4b66 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultWeight is default weight
	DefaultWeight = 1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	// contains filtered or unexported fields
}

Edge implements store.Edge

func NewEdge

func NewEdge(uid string, from, to store.Node, opts ...Option) *Edge

NewEdge creates an edge between two nodes and returns it

func (*Edge) Attributes

func (e *Edge) Attributes() []encoding.Attribute

Attributes returns attributes as a slice of encoding.Attribute

func (*Edge) Attrs

func (e *Edge) Attrs() attrs.Attrs

Attrs returns edge attributes

func (*Edge) From

func (e *Edge) From() store.Node

From returns the from node of the edge

func (*Edge) Metadata

func (e *Edge) Metadata() metadata.Metadata

Metadata reutnrs edge metadata

func (Edge) Options

func (e Edge) Options() Options

Options return options

func (*Edge) To

func (e *Edge) To() store.Node

To returns the to node of an edge

func (*Edge) UID

func (e *Edge) UID() string

UID returns edge uid

func (*Edge) Weight

func (e *Edge) Weight() float64

Weight returns edge weight

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node implements store.Node

func NewNode

func NewNode(uid string, opts ...Option) *Node

NewNode creates a new node and returns it

func (*Node) Attributes

func (n *Node) Attributes() []encoding.Attribute

Attributes returns attributes as a slice of encoding.Attribute

func (*Node) Attrs

func (n *Node) Attrs() attrs.Attrs

Attrs returns node attributes

func (*Node) Metadata

func (n *Node) Metadata() metadata.Metadata

Metadata returns node metadata

func (Node) Options

func (n Node) Options() Options

Options returns node options

func (*Node) UID

func (n *Node) UID() string

UID returns node uid

type Option

type Option func(*Options)

Option sets options

func Attrs

func Attrs(a attrs.Attrs) Option

Attrs sets entity attributes

func Metadata

func Metadata(m metadata.Metadata) Option

Metadata sets entity metadata

func Relation

func Relation(r string) Option

Relation configures entity relation

func Weight

func Weight(w float64) Option

Weight returns entity weight

type Options

type Options struct {
	Attrs    attrs.Attrs
	Metadata metadata.Metadata
	Weight   float64
	Relation string
}

Options are store options

func NewOptions

func NewOptions() Options

NewOptions returns empty options

Jump to

Keyboard shortcuts

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