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{}
}
interface for sortable entities
type TopologicalSorter ¶
type TopologicalSorter struct {
// contains filtered or unexported fields
}
service for sorting and searching entities
func (TopologicalSorter) Child ¶
func (ts TopologicalSorter) Child(parent interface{}) ([]interface{}, error)
getting children entities by parent id
func (*TopologicalSorter) Exists ¶
func (ts *TopologicalSorter) Exists(parent, self int) bool
check for exists by parent and self values
func (*TopologicalSorter) Push ¶
func (ts *TopologicalSorter) Push(entity SortableEntity) error
adding entities for sorting
func (*TopologicalSorter) PushAll ¶
func (ts *TopologicalSorter) PushAll(entities ...SortableEntity) (err error)
adding from entities slice for sorting
Click to show internal directories.
Click to hide internal directories.