Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrVertexDefined = errors.New("vertex is defined")
Functions ¶
This section is empty.
Types ¶
type SortableEntity ¶
type SortableEntity interface {
// returns entity id
Self() interface{}
// returns id of parent entity
Parent() interface{}
// set children elements
SetChildren(interface{})
}
SortableEntity interface for sortable entities
type TopologicalSorter ¶
type TopologicalSorter struct {
// contains filtered or unexported fields
}
TopologicalSorter represents service for sorting and searching entities
func (TopologicalSorter) Child ¶
func (ts TopologicalSorter) Child(parent interface{}) ([]interface{}, error)
Child returns children entities by parent id
func (*TopologicalSorter) Exists ¶
func (ts *TopologicalSorter) Exists(parent, self int) bool
Exists checks for exists by parent and self values
func (*TopologicalSorter) Push ¶
func (ts *TopologicalSorter) Push(entity SortableEntity) error
Push adds entities for sorting
func (*TopologicalSorter) PushAll ¶
func (ts *TopologicalSorter) PushAll(entities ...SortableEntity) (err error)
PushAll adds from entities slice for sorting
Click to show internal directories.
Click to hide internal directories.