ltree

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCircuitDependency = errors.New("circuit dependency")

Functions

This section is empty.

Types

type Entry

type Entry[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewEntry

func NewEntry[K comparable, V any](key K, value V, need []K, isAsync bool) *Entry[K, V]

func (*Entry[K, V]) DependsOn

func (e *Entry[K, V]) DependsOn() []K

func (*Entry[K, V]) IsAsync

func (e *Entry[K, V]) IsAsync() bool

func (*Entry[K, V]) Key

func (e *Entry[K, V]) Key() K

func (*Entry[K, V]) Value

func (e *Entry[K, V]) Value() V

type Executor

type Executor[K comparable, V any] interface {
	Key() K
	Value() V
	IsAsync() bool
	DependsOn() []K
}

type Layer

type Layer[K comparable, V any] struct {
	Nodes      []*Node[K, V]
	AsyncCount int
	SyncCount  int
}

type Node

type Node[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode[K comparable, V any](v Executor[K, V]) *Node[K, V]

func (*Node[K, V]) AddParent

func (n *Node[K, V]) AddParent(v *Node[K, V])

func (*Node[K, V]) HasParent

func (n *Node[K, V]) HasParent(v *Node[K, V]) bool

func (*Node[K, V]) IsVisited

func (n *Node[K, V]) IsVisited() bool

func (*Node[K, V]) SetVisited

func (n *Node[K, V]) SetVisited(visited bool)

type TreeLayer

type TreeLayer[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewTreeLayer

func NewTreeLayer[K comparable, V any]() *TreeLayer[K, V]

func (*TreeLayer[K, V]) Add

func (t *TreeLayer[K, V]) Add(entries ...Executor[K, V]) error

func (*TreeLayer[K, V]) AsyncCount

func (t *TreeLayer[K, V]) AsyncCount(layer int) int

func (*TreeLayer[K, V]) Execute

func (t *TreeLayer[K, V]) Execute(ctx context.Context, executor func(ctx context.Context, k K, n V))

func (*TreeLayer[K, V]) GetLayersCount

func (t *TreeLayer[K, V]) GetLayersCount() int

GetLayersCount returns the number of layers in the tree

func (*TreeLayer[K, V]) GetNodeDependencies

func (t *TreeLayer[K, V]) GetNodeDependencies(key K) []K

GetNodeDependencies returns the dependencies of a given node

func (*TreeLayer[K, V]) GetNodeKeys

func (t *TreeLayer[K, V]) GetNodeKeys() []K

GetNodeKeys returns all the keys of nodes in the tree

func (*TreeLayer[K, V]) GetNodesInLayer

func (t *TreeLayer[K, V]) GetNodesInLayer(layer int) int

GetNodesInLayer returns the number of nodes in a specific layer

func (*TreeLayer[K, V]) GetPretty

func (t *TreeLayer[K, V]) GetPretty() string

GetPretty returns a readable representation of the LTree

func (*TreeLayer[K, V]) Layers

func (t *TreeLayer[K, V]) Layers() int

func (*TreeLayer[K, V]) Retrieve

func (t *TreeLayer[K, V]) Retrieve(layer int) (async chan *Node[K, V], sync chan *Node[K, V])

func (*TreeLayer[K, V]) SyncCount

func (t *TreeLayer[K, V]) SyncCount(layer int) int

Jump to

Keyboard shortcuts

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