Debian Codegraph @

v2/sarif/location_relationship.go

raw
1 package sarif
2
3 // LocationRelationship ...
4 type LocationRelationship struct {
5 Target uint `json:"target"`
6 Kinds []string `json:"kinds,omitempty"`
7 Description *Message `json:"description,omitempty"`
8 PropertyBag
9 }
10
11 // NewLocationRelationship creates a new LocationRelationship and returns a pointer to it
12 func NewLocationRelationship(target int) *LocationRelationship {
13 t := uint(target)
14 return &LocationRelationship{
15 Target: t,
16 }
17 }
18
19 // WithKinds sets the Kinds
20 func (locationRelationship *LocationRelationship) WithKinds(kinds []string) *LocationRelationship {
21 locationRelationship.Kinds = kinds
22 return locationRelationship
23 }
24
25 // AddKind ...
26 func (locationRelationship *LocationRelationship) AddKind(kind string) {
27 locationRelationship.Kinds = append(locationRelationship.Kinds, kind)
28 }
29
30 // WithDescription sets the Description
31 func (locationRelationship *LocationRelationship) WithDescription(message *Message) *LocationRelationship {
32 locationRelationship.Description = message
33 return locationRelationship
34 }
35
36 // WithDescriptionText sets the DescriptionText
37 func (locationRelationship *LocationRelationship) WithDescriptionText(text string) *LocationRelationship {
38 if locationRelationship.Description == nil {
39 locationRelationship.Description = &Message{}
40 }
41 locationRelationship.Description.Text = &text
42 return locationRelationship
43 }
44
45 // WithDescriptionMarkdown sets the DescriptionMarkdown
46 func (locationRelationship *LocationRelationship) WithDescriptionMarkdown(markdown string) *LocationRelationship {
47 if locationRelationship.Description == nil {
48 locationRelationship.Description = &Message{}
49 }
50 locationRelationship.Description.Markdown = &markdown
51 return locationRelationship
52 }