File: location.go

package info (click to toggle)
golang-github-owenrumney-go-sarif 2.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 712 kB
  • sloc: makefile: 13
file content (53 lines) | stat: -rw-r--r-- 1,486 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package sarif

// Location ...
type Location struct {
	PropertyBag
	Id               *uint                   `json:"id,omitempty"`
	PhysicalLocation *PhysicalLocation       `json:"physicalLocation,omitempty"`
	LogicalLocations []*LogicalLocation      `json:"logicalLocations,omitempty"`
	Message          *Message                `json:"message,omitempty"`
	Annotations      []*Region               `json:"annotations,omitempty"`
	Relationships    []*LocationRelationship `json:"relationships,omitempty"`
}

// NewLocation ...
func NewLocation() *Location {
	return &Location{}
}

// NewLocationWithPhysicalLocation ...
func NewLocationWithPhysicalLocation(physicalLocation *PhysicalLocation) *Location {
	return NewLocation().WithPhysicalLocation(physicalLocation)
}

// WithId ...
func (l *Location) WithId(id int) *Location {
	i := uint(id)
	l.Id = &i
	return l
}

// WithPhysicalLocation ...
func (l *Location) WithPhysicalLocation(physicalLocation *PhysicalLocation) *Location {
	l.PhysicalLocation = physicalLocation
	return l
}

// WithMessage ...
func (l *Location) WithMessage(message *Message) *Location {
	l.Message = message
	return l
}

// WithAnnotation ...
func (l *Location) WithAnnotation(region *Region) *Location {
	l.Annotations = append(l.Annotations, region)
	return l
}

// WithRelationship ...
func (l *Location) WithRelationship(locationRelationship *LocationRelationship) *Location {
	l.Relationships = append(l.Relationships, locationRelationship)
	return l
}