/
address.go
66 lines (55 loc) · 1.66 KB
/
address.go
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
54
55
56
57
58
59
60
61
62
63
64
65
66
package sarif
type Address struct { // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541049
PropertyBag
Index *uint `json:"index,omitempty"`
AbsoluteAddress *uint `json:"absoluteAddress,omitempty"`
RelativeAddress *int `json:"relativeAddress,omitempty"`
OffsetFromParent *int `json:"offsetFromParent,omitempty"`
Length *int `json:"length,omitempty"`
Name *string `json:"name,omitempty"`
FullyQualifiedName *string `json:"fullyQualifiedName,omitempty"`
Kind *string `json:"kind,omitempty"`
ParentIndex *uint `json:"parentIndex,omitempty"`
}
func NewAddress() *Address {
return &Address{}
}
func (a *Address) WithIndex(index int) *Address {
i := uint(index)
a.Index = &i
return a
}
func (a *Address) WithAbsoluteAddress(absoluteAddress int) *Address {
i := uint(absoluteAddress)
a.AbsoluteAddress = &i
return a
}
func (a *Address) WithRelativeAddress(relativeAddress int) *Address {
a.RelativeAddress = &relativeAddress
return a
}
func (a *Address) WithOffsetFromParent(offsetFromParent int) *Address {
a.OffsetFromParent = &offsetFromParent
return a
}
func (a *Address) WithLength(length int) *Address {
a.Length = &length
return a
}
func (a *Address) WithName(name string) *Address {
a.Name = &name
return a
}
func (a *Address) WithFullyQualifiedName(fullyQualifiedName string) *Address {
a.FullyQualifiedName = &fullyQualifiedName
return a
}
func (a *Address) WithKind(kind string) *Address {
a.Kind = &kind
return a
}
func (a *Address) WithParentIndex(parentIndex int) *Address {
i := uint(parentIndex)
a.ParentIndex = &i
return a
}