| 1 |
package sarif |
| 2 |
|
| 3 |
// Edge ... |
| 4 |
type Edge struct { |
| 5 |
ID string `json:"id"` |
| 6 |
Label *Message `json:"label,omitempty"` |
| 7 |
SourceNodeID string `json:"sourceNodeId"` |
| 8 |
TargetNodeID string `json:"targetNodeId"` |
| 9 |
PropertyBag |
| 10 |
|
| 11 |
} |
| 12 |
|
| 13 |
// NewEdge creates a new Edge and returns a pointer to it |
| 14 |
func NewEdge(id, sourceNodeID, targetNodeID string) *Edge { |
| 15 |
return &Edge{ |
| 16 |
ID: id, |
| 17 |
SourceNodeID: sourceNodeID, |
| 18 |
TargetNodeID: targetNodeID, |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
// WithID sets the ID |
| 23 |
func (edge *Edge) WithID(id string) *Edge { |
| 24 |
edge.ID = id |
| 25 |
return edge |
| 26 |
} |
| 27 |
|
| 28 |
// WithLabel sets the Label |
| 29 |
func (edge *Edge) WithLabel(label *Message) *Edge { |
| 30 |
edge.Label = label |
| 31 |
return edge |
| 32 |
} |
| 33 |
|
| 34 |
// WithLabelText sets the LabelText |
| 35 |
func (edge *Edge) WithLabelText(text string) *Edge { |
| 36 |
edge.Label = &Message{ |
| 37 |
Text: &text, |
| 38 |
} |
| 39 |
return edge |
| 40 |
} |
| 41 |
|
| 42 |
// WithLabelMarkdown sets the LabelMarkdown |
| 43 |
func (edge *Edge) WithLabelMarkdown(markdown string) *Edge { |
| 44 |
edge.Label = &Message{ |
| 45 |
Markdown: &markdown, |
| 46 |
} |
| 47 |
return edge |
| 48 |
} |