Documentation ¶
Index ¶
- type Link
- func (nl *Link[K, V]) Clone() Linker[K]
- func (nl *Link[K, V]) Each(name K, fn func(K, Linker[K]))
- func (nl *Link[K, V]) Find(name K, key K) (Linker[K], bool)
- func (nl *Link[K, V]) Get(name K) Linker[K]
- func (nl *Link[K, V]) Item() *V
- func (nl *Link[K, V]) Len(name K) int
- func (nl *Link[K, V]) LinkOneMany(name K, key K, vtx Linker[K])
- func (nl *Link[K, V]) LinkOneOne(name K, key K, vertex Linker[K])
- func (nl *Link[K, V]) MarshalJSON() ([]byte, error)
- func (nl *Link[K, V]) SetItem(item *V)
- func (nl *Link[K, V]) UnlinkAllOneMany(name K) []Linker[K]
- func (nl *Link[K, V]) UnlinkOneMany(name K, key K) (Linker[K], bool)
- func (nl *Link[K, V]) UnlinkOneOne(name K) (Linker[K], bool)
- func (nl *Link[K, V]) UnlinkOneOneByKey(name K, key K) (Linker[K], bool)
- func (nl *Link[K, V]) UnmarshalJSON(data []byte) error
- func (nl *Link[K, V]) Vertex() Linker[K]
- type Linker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Link ¶
Link is a vertex in a graph that can be linked to other vertices. It is a named vertex that can have multiple edges to other vertices. There are two types of edges: one-to-one and one-to-many.
func NamedVertexWithVertex ¶
func NewNamedVertexWithValue ¶
func (*Link[K, V]) LinkOneMany ¶
LinkOneMany adds an edge from this vertex to specified vertex
func (*Link[K, V]) LinkOneOne ¶
LinkOneOne links a vertex to the vertex
func (*Link[K, V]) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*Link[K, V]) UnlinkAllOneMany ¶
UnlinkAllOneMany removes all edges from the vertex and returns them
func (*Link[K, V]) UnlinkOneMany ¶
UnlinkOneMany removes links to a vertex and returns the vertex
func (*Link[K, V]) UnlinkOneOne ¶
UnlinkOneOne unlinks a vertex from the vertex and returns the vertex
func (*Link[K, V]) UnlinkOneOneByKey ¶
UnlinkOneOne unlinks a vertex from the vertex and returns the vertex
func (*Link[K, V]) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
type Linker ¶
type Linker[K cmp.Ordered] interface { Vertex() Linker[K] Get(K) Linker[K] Len(K) int Find(K, K) (Linker[K], bool) Each(K, func(K, Linker[K])) LinkOneMany(K, K, Linker[K]) UnlinkOneMany(K, K) (Linker[K], bool) UnlinkAllOneMany(K) []Linker[K] LinkOneOne(K, K, Linker[K]) UnlinkOneOne(K) (Linker[K], bool) UnlinkOneOneByKey(K, K) (Linker[K], bool) Clone() Linker[K] }