Documentation ¶
Index ¶
- type Combo
- type Direction
- type Graph
- func (this *Graph) AddCombo(combo ...*Combo) error
- func (this *Graph) AddLine(line ...*Line) error
- func (this *Graph) AddNode(node ...*Node) error
- func (this *Graph) ComboCount() int
- func (this *Graph) DeleteCombo(ids ...string)
- func (this *Graph) DeleteLine(ids ...string)
- func (this *Graph) DeleteNode(ids ...string)
- func (this *Graph) FindCombo(f ...func(combo *Combo) bool) []*Combo
- func (this *Graph) FindLine(f ...func(line *Line, left, right *Node) bool) []*Line
- func (this *Graph) FindNode(f ...func(node *Node) bool) []*Node
- func (this *Graph) GetCombo(id string) *Combo
- func (this *Graph) GetLine(id string) *Line
- func (this *Graph) GetNode(id string) *Node
- func (this *Graph) GetNodeLines(id string) []*Line
- func (this *Graph) GetNodeNeighbours(id string) []*Node
- func (this *Graph) LineCount() int
- func (this *Graph) NodeCount() int
- func (this *Graph) Traversal(from, to string, f ...func(path *Path, ended bool) bool) []*Path
- func (this *Graph) Update() (err error)
- type Line
- type Node
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Combo ¶
type Combo struct { Id string `json:"id,omitempty"` // 组合 ID,在一个图中唯一 Type string `json:"type,omitempty"` // 组合类型(可选,可以用于指示 Data 的结构) ComboId string `json:"combo_id,omitempty"` // 父级 Combo 的 ID Data mapUtil.StringObjectMap `json:"data,omitempty"` // 节点数据 }
Combo 组合
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph 图结构
func (*Graph) AddCombo ¶
AddCombo 添加组合框
注意:在变更数据之后,需要调用 Update 更新图。
返回值:
error: 如果要添加的组合框已经存在,则会报 “combo 'xxx' already exists” 错误。
func (*Graph) AddLine ¶
AddLine 添加连线
注意:在变更数据之后,需要调用 Update 更新图。
返回值:
error: 如果要添加的连线已经存在,则会报 “line 'xxx' already exists” 错误。
func (*Graph) AddNode ¶
AddNode 添加节点
注意:在变更数据之后,需要调用 Update 更新图。
返回值:
error: 如果要添加的节点已经存在,则会报 “node 'xxx' already exists” 错误。
func (*Graph) GetNodeLines ¶
根据 ‘节点 ID’,获取与该节点直接关联的连线
func (*Graph) GetNodeNeighbours ¶
根据 ‘节点 ID’,获取与该节点直接关联的邻居节点。
type Line ¶
type Line struct { Id string `json:"id,omitempty"` // 连线 ID,在一个图中唯一 Left string `json:"left,omitempty"` // 左侧节点 ID Right string `json:"right,omitempty"` // 右侧节点 ID Direction Direction `json:"direction,omitempty"` // 连线方向 Type string `json:"type,omitempty"` // 连线类型(可选,可以用于指示 Data 的结构) Data mapUtil.StringObjectMap `json:"data,omitempty"` // 节点数据 }
Line 节点间的连线
type Node ¶
type Node struct { Id string `json:"id,omitempty"` // 节点 ID,在一个图中唯一 Level int `json:"level,omitempty"` // 节点层级(可选,可以用于树状布局时指定 节点 的层级) Type string `json:"type,omitempty"` // 节点类型(可选,可以用于指示 Data 的结构) ComboId string `json:"combo_id,omitempty"` // 节点所属的 Combo 的 ID Data mapUtil.StringObjectMap `json:"data,omitempty"` // 节点数据 }
Node 节点
Click to show internal directories.
Click to hide internal directories.